Mayur Gosalia

Ranch Hand
+ Follow
since Jan 03, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Mayur Gosalia

i have solved this. I recreated the entire workspace again and reinstall eclipse on my machine. I dont know what caused the issue but its now solved. Thank you guys
Ok refreshing the workspace has solved the out of sync error. I am trying to create this jar file using the export wizard in eclipse. I managed to create it before using the same procedure but now that System.exit is working, i try to do the same and it doesnt work. I m doing following:

File - Export - Jar File. Then click next
From the src folder select the file and resources i want in jar file and tick the export generated class file resources. Then next
Then in handling problems tick both the boxes at top. click next
Then create a manifest and select main class then finish.

That worked before i deleted the System.class file, which had to be done to solve the initial problem. Error message now reads:

JAR creation failed. See details for additional information.
Exported with compile warnings: Java System/src/AsdaSystem.java
File not found: L:\Mayur\SHU\Final Year\Project\Program\Java System\bin\System.class.
L:\Mayur\SHU\Final Year\Project\Program\Java System\bin\System.class (The system cannot find the file specified)
Exported with compile warnings: Java System/src/systemBeans/SystemBean.java
Right sorry to repost in this topic. I deleted the system.class file and now system.exit(1) works. So i try to recreate my jar file and it fails with the following.

JAR creation failed. See details for additional information.
Exported with compile warnings: Java System/src/AsdaSystem.java
File not found: L:\Mayur\SHU\Final Year\Project\Program\Java System\bin\System.class.
L:\Mayur\SHU\Final Year\Project\Program\Java System\bin\System.class (The system cannot find the file specified)
Exported with compile warnings: Java System/src/systemBeans/SystemBean.java
Resource is out of sync with the file system: '/Java System/src/AsdaSystem.ldb'.

For some reason it wants that System.class or it is referring to it. I have double checked/triple checked i havent used System anywhere in the app, i dont know what causing the Jar file creation to fail like this.
Absolute legend. that works!

Thank you very much guys!
Ok i have a System.class file. I dont have an import system in my class. and i have searched the relative files and none of them have anything like system within them. When you say classpath what do you exactly mean?
I have used terms such as AsdaSystem and systemBean but not specifically "System". System.out.println is not working either, it cannot be resolved is the error i get.
Hi,

Up until yesterday my application had no errors but now weirdly i get an error on System.exit(1). Error says: "The method exit(int) is undefined for the type System". I have tried googling but no had much luck, you guys have any idea as to what is causing this? System.exit(1) has always worked for me but now all of sudden its stopped.

Thank You
TAHNK YOU SO MUCH PETE. I really appreciate your help.

ClassLoader cl = this.getClass().getClassLoader();
image = new ImageIcon(cl.getResource("images/Asda Logo.gif"));

I have used the above and your example of directory layout really helped. It is working now and all the image appear in the JAR file. Thank you for your patience, really appreciate it.

Thanks
15 years ago
Yes it has been recognised as a package in eclipse with 1 file (image file). Now i change my code in .java file to include this image and then run the file in eclipse to see if it is working and this is when i get null pointer exception. If i cant run the program in eclipse after changing code , i m sure jar file wont work either.
15 years ago
My image is not in the sub directory, it just lies in the root of the project directory.

Folder called Project - this is my workspace
Folder called JavaSystem - this is the project folder

I have created a sub directory called images within the src folder now and added the image to the folder. Now using the throws a null pointer.


15 years ago
I believe i am adding these a file i think not sure :



Thats the code i use to add the image so i believe its a file. Do you have link to tutorial or something that would allow me to change this to a resource?
15 years ago
Well, it in JAR file wizard where you have to select all the files, i select all the files and tick the "Export Generated class file and resources" and "Export Java Source Files and Resources". I dont see an option where it would allow me to select the image as a file or a resource. Sorry to be a nuisance.
15 years ago
Hi,

I have used a Image in my application (Banner). The image is missing everywhere in the application, i select it while creating the jar file but for some reaosn it doesnt display it. However if i run the app from Eclipse the image is there.

This is my directory layout:

Program - workspace
Java System - Project (inside this folder is the image) and src folder
SRC folder has .java file which are my java files.

I select the files i need and its fine apart from that image.
15 years ago
Ah thanks. It works now but it doesnt display the Banner Image that i selected in the Jar file. Everything else is fine apart from the Banner image that is missing from the Jar file. Any ideas?
15 years ago
Hi,

I have application designed in eclipse, which i want to convert into jar file. I tried to export it as a Jar file from eclipse and it create a small file on my desktop but when i try to open the file it gives me an error: Failed to Load Main-Class Manifest Attribute from C:\Users\Maz\Desktop\Test.Jar

I believe i need a manifest file or something? I am new to this manifest file can you guys please advise?

Thank You
15 years ago