How To Create A JAR File
Jan 30, 2014
how to create a JAR File I have been watching you tube and it seems like the manifest needs to be remade. I go to the CMD and find my project folder class. I think I need to use do the same for all the classes correct. Well I type jar -cf TictacToeGUIGame.jar *java then I get no such directory. I can see the it worked thought. So do i do this to all my classes and then I will have my JAR program?
View Replies
ADVERTISEMENT
Dec 9, 2014
I am working on a project that requires me to build a database with random access file, representing products, the base product contains a name (about 30 characters), a price (double), and a quantity (integer). I have worked on this project for probably 15+ hours and have tried so many things and feel like I've barley made any progress...
The part i am really struggling with is taking the data from the text file and creating an object array with it using the product class. Once ive accomplished that, i have to use that data to create a random access file with the data. Here is the base Product class that must be used to create the objects for the array.
public class Product
{
public String pName;
public String stringName;
public double price;
public int quanity;
[Code]...
these continue for about 40-50 entries, they are not seperated by a blank line though i had to add those so it would display correctly, each entry is on its own line with name seperated with spaces, then price after a comma, then quanity after the second comma.....
View Replies
View Related
Mar 15, 2014
1. creates a file.
2. ask user to write into that file
3. save the file
4. print content of file.
Is my current exercise, so far i have gotten the code to create a file. What should i use to ask user to write into that file and save?
package assignment7;
import java.io.*;
public class Exercise2
{
public static void main ( String [ ] args ) {
String filePath="newfile.txt";
File newFile = new File ( filePath ) ;
[Code] .....
View Replies
View Related
Mar 17, 2014
1. creates a file.
2. ask user to write into that file
3. save the file
4. print content of file.
is my current exercise.so far i have gotten the code to create a file, and ask the user to input their age.what should i use to save what the user writes into the file?
Java Code:
package assignment7;
import java.io.*;
import java.util.*;
public class Exercise2
{
public static void main ( String [ ] args ) throws IOException
{
Scanner scan = new Scanner(System.in);
[code]....
View Replies
View Related
Mar 9, 2015
I am new to java and I am creating a system that will ask the user to create a file that will store to a text file, Once the user created the file I have a class that will let the user input the subject name that has been created, However, I keep on getting this java.util.nosuchelementexception.Here's my code:
public void display_by_name()
{
String id, name,total;
String key[]=new String[30];
String value[]=new String[30];
int i=0;
[code]....
View Replies
View Related
Sep 24, 2014
Well my code is supposed to ask for an input file and then (ex: input.txt), read the input file and create an output.txt file with the anagram for the words in the file. Also it should be displayed on the screen. However my code doesn't display the anagram on screen or the output file!
Heres is the code:
import java.io.*;
import java.lang.*;
import java.util.*;
/* This program will read a file given by the user, read the words within the file and determine anagrams of the given words. If the file that the user inputs is empty, then the program will output "The input file is empty."
* The program will read the file line by line, counting the total number of words read. If there are more than 50 words, "There are more than 50 words."
* will be printed, and the program will terminate. After each line is read, the words in the line will be separated,punctuation characters will be removed, and upper case characters will be switched to lower case.
* If any word is larger than 12 characters, that word will not be considered in the total amount of words in the file and it will not be sorted.
* After each word is read, the letters will be sorted and stored into an array containing each
* word's 'signature'. After all the words have been read, words will be printed to the output file on the same line based upon their signature.
*/
public class Anagram {
//Creating constants for maximum words in file and maximum chars in word
public static final int MAX_CHARS = 12;
public static final int MAX_WORDS = 50;
[Code] ....
View Replies
View Related
Jan 29, 2015
i have made one desktop application with swing and i have uses one textfile (File) in it. i want to handover to another friend to use it . How to create jar file of that program with that text file so that my friend use it without any issue . I have made it in NetBeans
View Replies
View Related
Feb 2, 2015
is it possible to make a .gif file with jave?
if it is, how is it done?
do i just create a bufferedGif object, or somemthing like that?
View Replies
View Related
Jul 17, 2014
code:
import java.io.*;
class FileWrite
{
public static void main(String args[])
[Code]....
error :
d:jpro>javac FileWrite.java
FileWrite.java:11: error: constructor File in class File cannot be applied to given types;
File f=new File(filename);
^
[Code].....
View Replies
View Related
Nov 9, 2014
create a jar file.Currently I have next files in my directory:
Manifest.txt:
-------------
Manifest-Version: 1.0
Created-By: 1.7.0_60-ea (Oracle Corporation)
Main-Class: connectURL
connectURL.class
------------------
it compiled fine, can be executed as:
java connectURL
it does not have 'Package' specified
sqljdbc4.jar
-----------
This is jdbc 4 jar file which is used by connectURL.java to make db. connection.
I am running:
C:j>jar cvfm connectURL.jar Manifest.txt *.class sqljdbc4.jar
added manifest
adding: connectURL.class(in = 2427) (out= 1358)(deflated 44%)
adding: sqljdbc4.jar(in = 584207) (out= 549364)(deflated 5%)
Then trying to execute and get error message
C:j>java -jar connectURL E520 1433
Error: Unable to access jarfile connectURL
View Replies
View Related
Apr 2, 2014
text file:
Codebase: myserver.com
Permissions: sandbox
Application-Name: Dynamic Tree Demo
error message from command line:
C:UsersxxxxDesktopCOMP268applet_ComponentArch_DynamicTreeDemoapplet_Comp
onentArch_DynamicTreeDemouildclasses>jar -cvfm DynamicTreeDemo.jar mymanifest
.txt appletComponentArch
java.io.IOException: invalid header field name: ?≫?Codebase
at java.util.jar.Attributes.read(Attributes.java:433)
at java.util.jar.Manifest.read(Manifest.java:199)
at java.util.jar.Manifest.<init>(Manifest.java:69)
at sun.tools.jar.Main.run(Main.java:172)
at sun.tools.jar.Main.main(Main.java:1177)
[/code]
encoding in UTF-8 and have newline at end
View Replies
View Related
May 10, 2014
File f=new File("c:/FilePractice/text.txt");
f.mkdirs();
and it creates only the folder text.txt.i am trying to create a blank txt file int this folder?what is the easiest way to do it? i try this one also:
[CODE]
PrintWriter writer = new PrintWriter("test.txt");
writer.close();
[CODE]
and its work but the test.txt file created in sort of default folder in my project folder.how can i make it in a folder that i want?
View Replies
View Related
May 29, 2014
I try to create a new xml file with DOM parser and i get this error in line 73.
Java Code: package RunMABS;
import java.io.File;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Transformer;
[code]....
View Replies
View Related
Sep 7, 2014
Is there any way to create file refrences so that it look's like there is a file in a directory while it actually is in a different directory?
View Replies
View Related
Feb 22, 2013
how to create pdf file while working in java.
View Replies
View Related
Jun 12, 2014
Actually I use MyEclise to develop and deploy a enterprise project(EAR file). I use Java Build Path to add some other projects and link sources, and added several jar files (as external jar and user library) to my project. (I used J2EE technology and there are some default jar of course )
By myeclise deploying manager I deployed my project on weblogic base_domain and then by weblogic console I deploy it on weblogic. All is set and there is no problem in all steps.
Now I wanna to create EAR file manually, first I created WAR file which included some jsf files and web-inf directory contains classes, lib directories and some important file like web.xml , facec-config.xml and etc.
In classes folder I have .class files which build correctly from .java files, and on lib directory**I copied all jar file from web-inf/lib directory** which created automatically by myeclipse deploying manager on weblogic base domain folder.
I added this War file into EAR file along APP-INF directory which contains all jar files from APP-INF/lib directory on weblogic base domain folder and META-INF directory what contains application.xml file.
When I deploy this ear file on weblogic there is so many error and problems. What is the correct way to create that EAR file.
View Replies
View Related
Feb 6, 2015
Lets say this txt file contains 2 lines.
---------
hello
bye
---------
What would i have to do to insert a a piece of text in between hello and bye? I would like for the it to search for "hello", then add a line after it so it would look like :
-------
hello
newtext
bye
-------
I have these 2 methods that work as intended, but i just cannot seem to do what i've stated above.
Java Code: /**
* @param location
* Location of the .txt file.
* @param text
* The String to search for in the .txt file.
[Code] ....
View Replies
View Related
Mar 30, 2014
Attached Images
File Type : 10.jpg (21.9 KB)
View Replies
View Related
Apr 26, 2014
How does one use java.util.jar.JarOutputStream to create a jar file on button press? This new jar file, I want to make it runnable so it performs a specific action on run..
View Replies
View Related
Nov 11, 2014
Why is my create jar file programatically not working? So doing this does create a jar file. When I run the jar file via command line, it gives me "Could not find or load main class ...". I'm not sure exactly why. I took some code i found here: java - How to use JarOutputStream to create a JAR file? - Stack Overflow and apparently it didn't specify the main class so I specifically added it myself. am i doing something wrong? And btw, the file (that contains all the class files) do not have any directories in them. so it's essentially just one folder with a bunch of class files in there. below is the code.
I had the commons-io-2.4 jar referenced into my build path that can be downloaded here: Commons IO - Download Commons IOreason i guess i added to that, though i'm not sure if it was necessary or not, was because it has a file filter which can tell which files are hidden or not and thing is without it it was adding like DS_STORE(which is hidden and i guess unnecessary) to the jar. not sure if this logic is right but just letting you know.
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.jar.Attributes;
import java.util.jar.JarEntry;
import java.util.jar.JarOutputStream;
[Code]...
View Replies
View Related
Jan 13, 2015
I was just wondering how would I create a jar file that would open 3 other jar files when I open the jar file with my batch file it and when I type stop in the batch file it will out put the stop command into all 3 of the other jar files.
This is for my Minecraft server so I can launch them all at the same time and inStead of having to enter the commands in all the server batch files I just have to do the command in 1 I know their is things like multi craft to do this but I want the code so I don't have to use multicraft.
View Replies
View Related
Aug 10, 2014
I am new to java. While compiling the "moooooo" program an error is displayed.
Error -- error while writing MooseGreetings :MooseGreetings.class
<access denied>.
What to do?
View Replies
View Related
Sep 10, 2014
"Write a program (save the program as ProductInventory.java) that will read data about 5 products from a text file (Products.txt. The program should use the data read from the file to create instances (objects) of Product.java(Use Product class as a Reference Type)."
I'm yet to discover how I will get the info from the textfile using scanners but I don't know how to "create instances of a reference type".
This is the code of Product.java that came with the exercise.
public class Product {
private String productCode = "";
private String productName = "";
private int quantity;
private String supplierName = "";
private String supplierAddress = "";
private double price;
[Code] .....
By the way, the exercise also required me to use the abstract class ProductLister. To be clearer, the text file is kinda like this:
54643
Rizer Mouse
Mark5s Merchandising
Marquee Mall
4
205.50
23412
Acer Ultrabook
JohnJade Merchandise
Cornal City
2
62200.00
93112
Dell Ultrabook
Octagon Marketing
Cornal City
3
68900.00
22126
Macbook Air Pro
Computerware Services
San Beda, Chad
2
93500.00
View Replies
View Related
Sep 17, 2014
I'm using Apache Poi to create an Excel file from a JTable.
I want to open the file directly in Excel, rather than first write it to disk and then open it from the disk.
FileOutputStream output = new FileOutputStream( StolleExcel.xls" );
workBook.write( output );
Desktop dt = Desktop.getDesktop();
dt.open( new File( "StolleExcel.xls" ) );
output.close();
Is there a temporary way of saving the Excel object then just opening it with Excel, so the user can save or edit whatever they want?
View Replies
View Related
Jun 26, 2015
I am trying to create a new text file in FTP Server using FTPClient but im not able to do. By using storeFile method i can only upload file that is already exists in my local system. But my requirement is to create file directly into FTP Server.
View Replies
View Related
Dec 27, 2014
I want to create a program where I need to create an object of list type such as text file will contain nos like 1,2,3,4,5 and write into text file and delete the in FIFO order i.e 1,2,3,4,5...how i can achieve to write a program? I tried bt everytime got concurrent modification exception or Array out of bound exception.
View Replies
View Related