Skip to main content
gamedev.net
🔒 Locked

[java] Executable JAR Files

Started by donbonifacio 4 replies 3.9k views
Original Post
donbonifacio
donbonifacio
Hi! I am having some troubles creating my exec jar files, I compile ok, I have the manifest file ok, and the jvm starts the main, but then it throws UndefClassFound when I try to create a class, for ex Data.MyClass. The error says that canot find Data/MyClass, but in the jar file exists dir Data and MyClass.class file. What am I doing wrong? o_O Tkz for any help. ____________________
Pedro Santos «» Project Y «» GameDevPT
Petr Stedry
Petr Stedry
Hi,

First check that the class contains the statement (first statement in MyClass.java file):

package Data;

Second check that everything is the same case (upper/lower). Java is case sensitive.

The manifest file must contain the line:

Main-Class: Data.MyClass

does this solve your problem ?

Petr Stedry

[edited by - Petr Stedry on January 11, 2003 9:31:12 AM]
Petr Stedry
donbonifacio
donbonifacio
I have WinMain.java at the root, then Data/MyClass.java, and yes, I have the package statment. I compile ok, I build with the manifest file:

Manifest-Version: 1.0
Main-Class: WinMain
Classpath: ./Agenda.jar

Agenda is my app. When I run java -jar Agenda.jar I get :
-
java.lang.NoClassDefFoundError: Data/Agenda
at WinMain.main(WinMain.java:7)
Exception in thread "main"
Process completed.
-

But if I unzip the Agenda.jar I have WinmMain.class at the rott and a dir Data with the MyClass.class in it.

WinMain code is


  
import java.awt.*;
import Graphical.AppWindows.*;
import Data.Agenda;

public class WinMain {
public static void main(String[] args) {
Agenda agenda = new Agenda(); <<--- ERROR!
WinAgenda winAgenda = new WinAgenda(agenda);
winAgenda.setVisible(true);
}
}


o_O

____________________
Pedro Santos «» Project Y «» GameDevPT
Petr Stedry
Petr Stedry
Ahh,

that''s EZ

I think you use the name of the jar file as if it would be a class. And so it comes, that you do not have a class named Agenda in the Data package, that''s the problem.
Btw. according to sun''s code conventions, the package names should be lowercase.

P.S.: If you can, please provide some explanation of your program''s architecture, so that I''m able to help you better.

Petr Stedry
Petr Stedry
donbonifacio
donbonifacio
But I have a Data.Agenda class! Structure:

WinMain.java
Data/Agenda.java
AppWindows/

If I could, I would send to you maybe the Agenda.jar file and the code, it´s a small project, in 100 kb top. Along with the .bat''s files that I am using, to see if you can help me. I have read several tutorials on this subject, and I still have the same problem.

"Btw. according to sun''s code conventions, the package names should be lowercase."
- Did not knew that, will use it in the future!

Tkz for your help.

____________________
Pedro Santos «» Project Y «» GameDevPT
Petr Stedry
Petr Stedry
Ok Pedro,

send it!

I''ll look into it tomorrow. Use the e-mail button.

have a nice day ...

Petr Stedry
Petr Stedry

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.