Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (552)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Main class not found (oh its there, alright)  (Read 2288 times)
0 Members and 1 Guest are viewing this topic.
Offline Kakashi266

Junior Member





« Posted 2010-08-20 18:11:56 »

I am trying to run an executable jar I created using Netbeans. I am using JOGL, and have those files referenced correctly in the ClassPath setting in the Manifest file. The main class is also correctly referenced in the Manifest file. Starting the jar sort of works. It creates a blank window the same size as the program should be. But nothing happens after that. I tried running it from the command line so errors would be printed... but nothing printed.

Just recently I figured out how to use the jdb (I'm not a hardcore programmer- it's a hobby I only indulge in every few months or so), and saw the error. Apparently the program cannot find my main class. As I said, it is referenced correctly in the the *automatically generated* Manifest file.

Now I know this has been posted here before, and all over the web, but I've never, ever found an answer that does anything. I'll provide more info if it's needed, but it'd be great if someone who's had and solved this problem could post.

Thanks, JavaGaming.

Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #1 - Posted 2010-08-20 18:18:25 »

Does your main class have:

1  
2  
3  
4  
public static void main(String[] args)
{
    run();
}


And the class / manifest should look like:

1  
public class MainClass


Manifest:
1  
Main-Class: MainClass


Don't forget the blank newline at the end. If your main class is automatically generated, you probably don't need to worry about that part.

See my work:
OTC Software
Offline Kakashi266

Junior Member





« Reply #2 - Posted 2010-08-20 18:24:22 »

I double checked (more like triple-triple-quadruple checked by now) and yes it's all on the up-and-up. Everything's typed out correctly and the Manifest file is formatted correctly.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 781
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #3 - Posted 2010-08-20 18:38:30 »

It creates a blank window the same size as the program should be.
Then obviously Java finds your main-class! How else can it create your window? It just crashes a bit later...

If you don't see anything on the commandline, try to start your app with:
System.out.println("Started!");
That should end up on the commandline.

If no exception is dumped on the console, you probably caught some exception and didn't print it:
exc.printStackTrace()


The actual problem probably has to do with the OS not finding the JOGL libraries. Put the DLLs in the same directory as your JAR, and see how that works out.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Kakashi266

Junior Member





« Reply #4 - Posted 2010-08-20 18:47:09 »

Then obviously Java finds your main-class! How else can it create your window? It just crashes a bit later...

If you don't see anything on the commandline, try to start your app with:
System.out.println("Started!");
That should end up on the commandline.

If no exception is dumped on the console, you probably caught some exception and didn't print it:
exc.printStackTrace()


The actual problem probably has to do with the OS not finding the JOGL libraries. Put the DLLs in the same directory as your JAR, and see how that works out.

I had considered that, actually. I tried making it print something. I ran it from the command line... It printed nothing ಠ_ಠ. Also the DLLs are indeed in the same directory as the jar. This makes no sense.

Offline Riven
« League of Dukes »

JGO Overlord


Medals: 781
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #5 - Posted 2010-08-20 18:53:32 »

If you have a static block in your class, they will be executed before the main() method.

Why don't you go back to basics and try to make a Hello World program work. No libs, no jars, just a *.class.

Once that works, put the class in the jar, and run it like:
java -cp hello.jar HelloWorld

Then add the manifest, with the Main-Class entry, and run:
java -jar hello.jar

Work from there.

When you find a bug _always_ simplify, fix it, try again. You'll never get anything done when you only determine that "super fancy code" doesn't work, and trying to fix it by trial and error.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Kakashi266

Junior Member





« Reply #6 - Posted 2010-08-20 19:04:55 »

Thanks for the advice. I tried and it doesn't work. There must be something wonky somewhere along the line. I'ma be right back- gonna DFE and start things from scratch.

EDIT - Okay I deleted all my Java installs, including Netbeans. I installed everything fresh, including a newer version of Netbeans. I loaded my project back in and got it working again in Netbeans. Built it- and NOTHING. Even better, I fired up one of the sample projects that uses JOGL, built that, and it worked. I'm at a loss.

Offline zoto

Senior Member


Medals: 4



« Reply #7 - Posted 2010-08-20 19:42:50 »

Does your manifest have a line like:
1  
Class-Path: lib/jogl.jar lib/gluegen-rt.jar

Offline Riven
« League of Dukes »

JGO Overlord


Medals: 781
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #8 - Posted 2010-08-20 19:46:51 »

EDIT - Okay I deleted all my Java installs, including Netbeans. I installed everything fresh, including a newer version of Netbeans. I loaded my project back in and got it working again in Netbeans. Built it- and NOTHING. Even better, I fired up one of the sample projects that uses JOGL, built that, and it worked. I'm at a loss.

take that sample project and put System.out.println("HelloWorld") on the first line in main(String[])
it should be written to the console

take that your own project and put System.out.println("HelloWorld") on the first line in main(String[])
is it written to the console?

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Kakashi266

Junior Member





« Reply #9 - Posted 2010-08-20 19:48:36 »

Indeed it does, Zoto. What really gets me is that one of the default JOGL demos works perfectly fine. I've checked that project's settings and libraries and manifest file and everything and it's all exactly the same. I'm thinking maybe the problem has to do with my code. I'm going to change my code to look like the basic structure of the demo (which differs a bit from my code). Unfortunately that will mostly have to wait until after work. I can't think of a more infuriating way to spend my day than working when I have something like this on my mind, heh.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 781
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #10 - Posted 2010-08-20 19:52:35 »

As said in my first reply, it's fairly likely that you caught and ignored an exception.

That, or you have buggy gfx drivers and you setup your context a bit different.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Kakashi266

Junior Member





« Reply #11 - Posted 2010-08-20 19:54:00 »

take that sample project and put System.out.println("HelloWorld") on the first line in main(String[])
it should be written to the console

take that your own project and put System.out.println("HelloWorld") on the first line in main(String[])
is it written to the console?

It seriously doesn't print anything either way. What the hell is wrong with my computer....

Offline Riven
« League of Dukes »

JGO Overlord


Medals: 781
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #12 - Posted 2010-08-20 19:57:01 »

Give ALL the code of your HelloWorld app.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Kakashi266

Junior Member





« Reply #13 - Posted 2010-08-20 19:58:42 »

Give ALL the code of your HelloWorld app.

Sorry that's going to have to wait. I need to go get ready for work tonight, like right now. When I get back I'm going to try my last ditch effort to fix the problem. Then I'll try putting up code.

Offline Kakashi266

Junior Member





« Reply #14 - Posted 2010-08-21 04:12:00 »

Okay I'm playing around with the sample demo that uses JOGL, and came with Netbeans. It works perfectly fine when built, so I think it has something to do with how the OpenGL is brought into the program. I'll play around with it.

Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #15 - Posted 2010-08-29 22:09:16 »

Maybe you found the problem in the meantime, but it sounds like your library path is incorrect so it can't find the required .dll/.so files.

Offline Riven
« League of Dukes »

JGO Overlord


Medals: 781
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #16 - Posted 2010-08-29 22:11:52 »

Maybe you found the problem in the meantime, but it sounds like your library path is incorrect so it can't find the required .dll/.so files.

Like what I said in my first reply Smiley

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #17 - Posted 2010-08-30 15:19:16 »

ah yes, indeed  Smiley

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CopyableCougar4 (23 views)
2014-08-22 19:31:30

atombrot (34 views)
2014-08-19 09:29:53

Tekkerue (30 views)
2014-08-16 06:45:27

Tekkerue (28 views)
2014-08-16 06:22:17

Tekkerue (18 views)
2014-08-16 06:20:21

Tekkerue (27 views)
2014-08-16 06:12:11

Rayexar (65 views)
2014-08-11 02:49:23

BurntPizza (41 views)
2014-08-09 21:09:32

BurntPizza (31 views)
2014-08-08 02:01:56

Norakomi (41 views)
2014-08-06 19:49:38
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!