• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

problem with manifiest or classpath

 
Greenhorn
Posts: 22
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello! i was looking in this forum for a problem like the one i have. i didnt found it.

so hope you can help me out. ok here i go (sorry for my awful english).

i have 4 classes in my proyect java named cobranza.

main class is Cobranza.class
uno.class
dos.class
recup.class

when i run the proyect with my IDE (netbeans) it runs normally, then i create the .jar and i run it in my desktop, also it runs normal.
but when i take my dist folder and i try to run it in other computer it sends me an error like this.

"can not found the main class cobranza.Cobranza, the program will exit"

so, i check my manifiest and the Main class is set to
cobranza.Cobranza.

everything is correct i think. So I ask you experts, have you pass into some trouble like this?.
thankyou!
 
lowercase baba
Posts: 13003
66
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Netbeans and other IDEs often 'fix' stuff for you, without you knowing it. That is why most folks around here recommend you learn to compile from the command line first.

Have you tried building your .jar file that way, without using NetBeans?
 
Bartender
Posts: 3323
86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

so, i check my manifiest and the Main class is set to
cobranza.Cobranza.

Have you checked the manifest file that is in the jar or the one you think is being added when you build the jar?
BTW it should contain "Main-Class: cobranza.Cobranza"

Does the jar contain a folder called cobranza which contains your class files?
 
Ubaldo Robledo
Greenhorn
Posts: 22
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tony Docherty wrote:Have you checked the manifest file that is in the jar or the one you think is being added when you build the jar?
BTW it should contain "Main-Class: cobranza.Cobranza"

Does the jar contain a folder called cobranza which contains your class files?



yes i unpacked the .jar file to check the main class assignated and it was cobranza.Cobranza

I also check in the properties of the proyect in the IDE and it was ok.
 
Ubaldo Robledo
Greenhorn
Posts: 22
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

fred rosenberger wrote:Netbeans and other IDEs often 'fix' stuff for you, without you knowing it. That is why most folks around here recommend you learn to compile from the command line first.

Have you tried building your .jar file that way, without using NetBeans?



no, i have not tried this, i let you know if it works. thanks
 
Ubaldo Robledo
Greenhorn
Posts: 22
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey guys, this is working now

I compiled with CMD (windows) and it does not run. so i checked the version of the JRE and it was a lower version.
I create and compiled it in the latest version (1.7.0_40) so i update the JRE and it works.

tricky one.

well thank you all guys. nice day!
 
Marshal
Posts: 74034
332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why have you got a different JRE and JDK in your PATH? Why have you not updated to 7u45? It is possible to execute .class files from an old javac application with a newer java tool, and you are suggesting the problem is the other way round.
 
Ubaldo Robledo
Greenhorn
Posts: 22
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Why have you got a different JRE and JDK in your PATH? Why have you not updated to 7u45? It is possible to execute .class files from an old javac application with a newer java tool, and you are suggesting the problem is the other way round.



No, maybe you didnt got me.

on my computer i have the jdk 1.7.0_40, jre 1.7.0_40 and netbeans 7.4. the aplication worked only in my computer, but in other ones it didnt, it was (i think) for the oldest JRE version in those machines. so, i update the JRE in my others computers, and it works.

am i being clear?, or do i missunderstand your point? (because my awful english, sorry).

do you know a workaround for my problem? should i update the JDK?
 
Sheriff
Posts: 26777
82
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ubaldo Robledo wrote:do you know a workaround for my problem? should i update the JDK?



I'm not sure what your problem is now, it seems like you have fixed everything. If your problem is that when you compile your code using Java 7 then it won't run on other people's machines which don't have Java 7, then what you should do is... it depends. Installing Java 7 on those people's machines works fine, as you have already found. (And as a side effect it provides them with a more secure Java version.) However if the other person is your boss and won't let you install Java 7 on his/her machine because of typical boss-like non-reasons then you would have to recompile using Java 6. Or not install your program there.
 
Ubaldo Robledo
Greenhorn
Posts: 22
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:
I'm not sure what your problem is now, it seems like you have fixed everything. If your problem is that when you compile your code using Java 7 then it won't run on other people's machines which don't have Java 7, then what you should do is... it depends. Installing Java 7 on those people's machines works fine, as you have already found. (And as a side effect it provides them with a more secure Java version.) However if the other person is your boss and won't let you install Java 7 on his/her machine because of typical boss-like non-reasons then you would have to recompile using Java 6. Or not install your program there.



you right!, that was my problem, and also it is the solution, I dont want to have several versions of the same proyect for diferents computers, so i will update the JVM.

I like this forum. is very easy to understand and to explain my problems with a lot of help. Thank you very mucho!! Paul, Campbell, Tony, and Fred!

great new year guys
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic