Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (808)
Games in Android Showcase (239)
games submitted by our members
Games in WIP (872)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1] 2
1  Game Development / Newbie & Debugging Questions / Re: JWrapper build not running correctly. on: 2014-12-30 11:18:34
Hey Stranger

Packr seems to do the trick. Thanks for your effort
I could also run the jar, but I don't know how to configure jwrapper properly.
Packr seems to do the job better and for free/no branding anyway

I've tested the .exe only on one other pc but it seems to work fine.
This is just the example app though, now I'm going to try and build my own app with packr and maven.
2  Game Development / Newbie & Debugging Questions / Re: JWrapper build not running correctly. on: 2014-12-30 08:16:46
Well jesus H christ after doing some research on what a "POM" is, I finally am able to build the example project and it runs from the .exe!

Thank you lord maven Roll Eyes
3  Game Development / Newbie & Debugging Questions / Re: JWrapper build not running correctly. on: 2014-12-30 03:07:28
Yep well I pretty much am. The build goes through successfully, but the app does not run.

.json:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
{
    "platform": "windows",
    "jdk": "C:/dev/resources/OpenJDK/openjdk-1.7.0-u60-unofficial-windows-i586-image.zip",
    "executable": "testapp",
    "appjar": "C:/dev/testapp/testapp.jar",
    "mainclass": "com/badlogicgames/packr/TestApp",
    "vmargs": [
        "-Xmx1G"
    ],
    "resources": [
        "pom.xml",
        "src/main/resources"
    ],
    "minimizejre": "soft",
    "outdir": "build"
}


I know resources is optional but I thought I'd try it to see if it made any difference.
4  Game Development / Newbie & Debugging Questions / Re: JWrapper build not running correctly. on: 2014-12-30 02:56:01
I can't even get the TestApp to build and run correctly. Were you able to do so? I have no idea what I'm doing wrong. I've tried rebuilding in 5 different ways since I woke up.  (Talking about packr)
5  Game Development / Newbie & Debugging Questions / Re: JWrapper build not running correctly. on: 2014-12-30 01:36:13
Interesting. Well it sounds like packr should work for me. But I'm having this problem where the exe wont even run, so I have no clue how to debug???
6  Game Development / Newbie & Debugging Questions / Re: JWrapper build not running correctly. on: 2014-12-29 13:39:35
So what options do I have when I want to wrap a JRE?

If I wanted to make a game in java, and release it so it has the best chance of running on someones system without the user worrying about having the correct jre installed?


7  Game Development / Newbie & Debugging Questions / Re: JWrapper build not running correctly. on: 2014-12-29 12:41:25
Hopefully someone who has experienced this issue before sees this post :/
8  Game Development / Newbie & Debugging Questions / Re: JWrapper build not running correctly. on: 2014-12-29 12:06:31
Indeed...exactly my problem :/
9  Game Development / Newbie & Debugging Questions / Re: JWrapper build not running correctly. on: 2014-12-29 11:59:13
Oh thanks so much! Are you using jwrapper or packr?
10  Game Development / Newbie & Debugging Questions / Re: JWrapper build not running correctly. on: 2014-12-29 11:27:39
Do you have any experience with packr?

I am kind of having the same problem with it Grin

I get this error during build:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder"
SLF4J: Defaulting to no operation (NOP) logger implementation

But it goes on with the build and seems to complete fine. That error/warning doesn't seem too important Huh

The app generated doesn't run at all.

The jar runs fine. I have a question: do you just run the jar, and it runs the .exe for the JVM? Or am I doing something wrong...

the .json file...

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
{
    "platform": "windows",
    "jdk": "C:/dev/OpenJDK/openjdk-1.7.0-u60-unofficial-windows-i586-image.zip",
    "executable": "game-exe",
    "appjar": "C:/dev/gameapp/bin/game.jar",
    "mainclass": "game/Game",
    "vmargs": [
       "-Xmx1G"
    ],
    "minimizejre": "soft",
    "outdir": "out-win"
}


Everything else is exactly the same as in OP
11  Game Development / Newbie & Debugging Questions / Re: JWrapper build not running correctly. on: 2014-12-29 11:14:30
For jwrapper? Yeah I did:

Just to be sure, here it is what you meant?

1  
2  
3  
<Windows32JRE>JRE-1.7/win32/jre1.7.0_05</Windows32JRE>

<Windows64JRE>JRE-1.7/win32/jre1.7.0_05</Windows64JRE>
12  Game Development / Newbie & Debugging Questions / Re: JWrapper build not running correctly. on: 2014-12-29 10:59:53
Hahahaha what?

I am looking at packr now. No clue what's going on with jwrapper.

Hopefully I can get past my own incompetence with packr.
13  Game Development / Newbie & Debugging Questions / JWrapper build not running correctly. on: 2014-12-29 04:38:03
After building and running the application file a load screen appears for a couple of seconds then disappears. After that, my program does not run.

I have tried setting up my project folder exactly like the example project from the jwrapper website. I am able to build and run the application from that example.

Not entirely sure if I have the XML correct or if I'm not creating my jar correctly.


Folder I copy jre into and run jwrapper (including jar and xml and everything else required):

http://www.4shared.com/zip/qOA-V1lnba/jwraptest.html

I go to this directory, type "java.exe -Xmx512m -jar jwrapper-00031607960.jar gameapp\jwrapper.xml" and it appears to build fine.

This is how I compiled:

javac -sourcepath $SRC -d $BIN Game.java Draw.java Frame.java

This is how I compiled jar (command line in bin dir):

jar -cvmf manifest.txt game.jar game

manifest was: "Main-Class: game.Game
"

Jar runs fine on its own. There is no error, I just can't run the application from the build. It has a loading screen on the first run, but nothing after that. It pops up in processes but that's about it.
14  Game Development / Newbie & Debugging Questions / Re: Running .jar error main class not found. on: 2014-12-29 03:27:04
http://www.4shared.com/zip/W_trDPGice/game.html

Here is a link to the zipped jar for you to try
15  Game Development / Newbie & Debugging Questions / Re: Running .jar error main class not found. on: 2014-12-29 01:42:32
I did this - same issue. I'll provide details of what I did after I try a couple of things.

However I am having a unrelated (maybe?) issue. After creating the jar file, I can't run it by double clicking on it. I get a "main class not found" error. When I run from the command line it works fine.

What could be causing this issue?

So there is no stacktrace, the error pops up in a window when I try to run the jar by double clicking.

Edit: Okay fixed that, file association issue. I will now see if the application runs correctly after a rebuild

Edit: Still not working...not really sure what to do now...
16  Game Development / Newbie & Debugging Questions / Re: Running .jar error main class not found. on: 2014-12-28 10:37:54
Of course, you've ran gameapp-java-online.jar (or something like this) in jwrapper's 'build' folder?

As I get it, you will have such a file after app's  building finished:

Quote
java.exe -Xmx512m -jar jwrapper-00031607960.jar gameapp\jwrapper.xml

Yes sir! Among others such as "GameApp-windows32-offline"

But running these does nothing. This is the problem, nothing happens
17  Game Development / Newbie & Debugging Questions / Re: Running .jar error main class not found. on: 2014-12-28 09:59:55
Does anyone know what I'm doing wrong?
18  Game Development / Newbie & Debugging Questions / Re: Running .jar error main class not found. on: 2014-12-28 08:04:26
Hey stranger,

There was a newline in manifest. I thought I was suppose to have it there.

Looking into rest of post but I'm not quite sure I understand the classpath stuff. (Edit: Appears jar wont even run without a newline in the manifest. As I've said before the jar on its own runs fine)

I haven't used -cp or -classpath in the cmd

also I'm not sure how I should set up my package???

Exactly how would you modify my code/packages/xml, in order to make it work?

Thanks for the help

This is how I use the command line:

Creating jar:

jar -cvmf manifest.txt game.jar *.class

Wrapping jar:

java.exe -Xmx512m -jar jwrapper-00031607960.jar gameapp\jwrapper.xml


Sorry if I am giving you information that you aren't looking for, I am having trouble understanding.

Changed main class attribute in xml from "Game" to ".Game", will let you know if it helped


It did not help
19  Game Development / Newbie & Debugging Questions / Re: Running .jar error main class not found. on: 2014-12-28 05:50:25
Bump
20  Game Development / Newbie & Debugging Questions / Re: Running .jar error main class not found. on: 2014-12-27 13:29:34
Quote from: Dreamtime link=topic=35173.msg333056#msg333056

Edit: My manifest.txt for the jar file is just "Main-Class: Game"

1. We first create a text file named Manifest.txt with the following contents:

Main-Class: MyPackage.MyClass

Warning: The text file must end with a new line or carriage return. The last line will not be parsed properly if it does not end with a new line or carriage return.

========================
2. How your classpath is defined?

1. If I did that incorrectly, would the .jar not run? Because it does. Is the manifest important part of Jwrapped application?

2. I don't understand what you mean.
1. this warning is from oracle docs. Manifest is the part of jar.
I can't say anything about JWrapper.
2. What you specified in classpath?

Specify when? When I make the jar? I haven't ever specified classpath.
I don't know how, or when to do so.

Unless you are talking about for jwrapper, if so you can see how in my xml file above
21  Game Development / Newbie & Debugging Questions / Re: Running .jar error main class not found. on: 2014-12-27 11:15:58
Quote from: Dreamtime link=topic=35173.msg333056#msg333056

Edit: My manifest.txt for the jar file is just "Main-Class: Game"

1. We first create a text file named Manifest.txt with the following contents:

Main-Class: MyPackage.MyClass

Warning: The text file must end with a new line or carriage return. The last line will not be parsed properly if it does not end with a new line or carriage return.

========================
2. How your classpath is defined?

1. If I did that incorrectly, would the .jar not run? Because it does. Is the manifest important part of Jwrapped application?

2. I don't understand what you mean.
22  Game Development / Newbie & Debugging Questions / Re: Running .jar error main class not found. on: 2014-12-27 00:36:14
Thanks. Their forums are down or something, and for now they're using stackoverflow. No reply yet.

Trying to find how to attach zip.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
import java.awt.*;
import java.awt.Component;
import java.awt.event.*;


public class Game
{
   Draw draw;
   Frame frame;
   Insets insets;
   
   boolean isRunning = true;  
   
   
   private int FPS = 30;
   private double averageFPS;
   
   public static void main(String[] args)
   {
      Game game = new Game();
      game.run();
      System.exit(0);
   }
   
   void run()
   {
      initialize();
     
      long startTime;
      long URDTimeMillis;
      long waitTime;
      long totalTime = 0;
     
      int frameCount = 0;
      int maxFrameCount = 30;
     
      long targetTime = 1000 / FPS;
     
      while(isRunning)
      {
         startTime = System.nanoTime();
         
         update();
         draw();
         
         URDTimeMillis = (System.nanoTime() - startTime) / 1000000;
         
         waitTime = targetTime - URDTimeMillis;
         
         try
         {
            Thread.sleep(waitTime);
         }
         catch(Exception e)
         {
         
         }
         
         totalTime += System.nanoTime() - startTime;
         frameCount++;
         
         if(frameCount == maxFrameCount)
         {
            averageFPS = 1000.0 / ((totalTime / frameCount) / 1000000);
            frameCount = 0;
            totalTime = 0;
         }
     
      }
     
      frame.close();
   }
   
   void initialize()
   {
     
     
      draw = new Draw();
      frame = new Frame();
     
      frame.add(draw);
   }
   
   void update()
   {}
   
   void draw()
   {
      frame.draw();
   }
}


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
import java.awt.*;
import javax.swing.*;
import java.awt.image.BufferedImage;
import javax.swing.JFrame;
import java.awt.Component;
import java.awt.event.*;

public class Frame extends JFrame
{
   int windowWidth = 960;
   int windowHeight = 480;
   Insets insets;
   
   public Frame()
   {
      setTitle("Game");
      setSize(windowWidth, windowHeight);
      setResizable(false);
      setDefaultCloseOperation(EXIT_ON_CLOSE);
      insets = getInsets();
      setSize(insets.left + windowWidth + insets.right, insets.top + windowHeight + insets.bottom);
     
      Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
      setLocation(dim.width/2-this.getSize().width/2, dim.height/2-this.getSize().height/2);
     
      setVisible(true);
   
   }

   
   public void close()
   {
      setVisible(false);
   }
}


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;

public class Draw extends JPanel
{
   public Draw()
   {
   
   }
   
   @Override
   protected void paintComponent(Graphics g)
   {
      super.paintComponent(g);
     
   }
   
   public void draw()
   {
      repaint();
   }
}


Just creates a window. After using jwrapper, the program runs but a window doesn't appear. I am following the instructions for the sample project and last night I was able to get that working, but translating to this is just doesn't run.

My project is called 'gametest'. Inside gametest there are two folders 'JRE-1.7' from extracting the jre pack. 'gameapp', contains game.jar (runs fine), jwrapper.xml, the sample logo/splash, two more folders, src and bin, bin class files, src source files.

XML:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
<JWrapper>
   
   <!-- The name of the app bundle -->
   <BundleName>GameApp</BundleName>
   
   <!-- The specification for one app within the bundle -->
   <App>
     <Name>Game</Name>
     <LogoPNG>gameapp/logo.png</LogoPNG>
     <MainClass>Game</MainClass>
     <Param>one</Param>
     <Param>two</Param>
   </App>
   
   <SupportedLanguages>en</SupportedLanguages>
   
   <!-- App is a per-user app, it won't elevate and install for all users and the shared config folder will be per-user -->
   <InstallType>CurrentUser</InstallType>
   
   <!-- Splash and Logo -->
   <SplashPNG>gameapp/splash.png</SplashPNG>
   <BundleLogoPNG>gameapp/logo.png</BundleLogoPNG>
   
   <!-- JVM options (e.g. extra memory) -->
   <JvmOptions>
    <JvmOption>-Xmx256m</JvmOption>
   </JvmOptions>
   
   <!-- The JREs JWrapper should use for Windows, Linux32, Linux64... -->
   <Windows32JRE>JRE-1.7/win32/jre1.7.0_05</Windows32JRE>
   <Windows64JRE>JRE-1.7/win32/jre1.7.0_05</Windows64JRE>
   <Linux32JRE>JRE-1.7/linux/jre1.7.0_13</Linux32JRE>
   <Linux64JRE>JRE-1.7/linuxx64/jre1.7.0_13</Linux64JRE>
   <Mac64JRE>JRE-1.7/macos64/jre1.7.0_45.jre</Mac64JRE>

   <!-- The files that the app wants to bundle, here we have just one which is a JAR file and we specify that it should be on the launch classpath -->
   <File classpath='
yes'>gameapp/game.jar</File>
   
</JWrapper>


Edit: My manifest.txt for the jar file is just "Main-Class: Game"
23  Game Development / Newbie & Debugging Questions / Re: Running .jar error main class not found. on: 2014-12-25 07:26:16
So this is frustrating. I got the JWrapper compile to work, so I have everything in a "JWrapperBuild" folder, not errors were produced, but when I try to run the application it doesn't run however java does start as a process. But program doesn't actually seem to be running  Huh

Edit: I've tried a bunch of different stuff but the same problem. I'm going to try and change the code so the main method isn't inside a main class that extends JFrame, and hopefully it runs properly. If not I'm out of ideas.

Edit2:

Yeah that didn't work.

anyone know what I'm doing wrong with this JWrapper business? There are no errors...The application kind of just starts and sits idle...

Edit3:

Tried jwrapping sample project. javax.image.io.IIOException: Can't read input file!

Also get this error when I try to use the sample xml as a template, as opposed to using the application to generate one.
24  Game Development / Newbie & Debugging Questions / Re: Running .jar error main class not found. on: 2014-12-25 00:03:23
I get a warning:
warning: [options] bootstrap class path not set in conjunction with -source 1.6

http://stackoverflow.com/questions/15882586/bootstrap-class-path-not-set

Trying to follow another questions answer:

javac -target 1.4 -bootclasspath jdk1.4.2/lib/classes.zip \
             -extdirs "" OldCode.java

Having trouble finding the zip folder, I downloaded an old JRE, 1.4.

Can I just point to the rt.jar?

JWrapper seems somewhat confusing to use.

Edit: the error says 1.6 because I c/p from the above link.


Oo interesting I compiled for 1.5 and created a jar, ran it, and now I'm getting the exact error my friend is getting(Java Virtual Machine Launcher: Could not find the main class!) . When double clicking on it.
When I run it from the command line, it runs fine?

Looks like the best solution is to just figure out how to get JWrapper to work, and use that

Edit:

Odd now I can't seem to run jar's by double clicking at all now. Just get that error message after downloading jre 1.4

Edit:

Exception using JWrapper - probably not doing it right - any help is appreciated

Folder source cannot be part of classpath!

I think I am misunderstanding what the classpath is?

The stacktrace is very long...hard to type all of that out

java.lang.Exception @ jwrapper.JWrapperCompiler.main(JWCompiler.java:112)

Oh and, Merry Christmas everyone.

25  Game Development / Newbie & Debugging Questions / Re: Running .jar error main class not found. on: 2014-12-24 23:22:05

Um, that's great! Thanks for the links! Smiley
26  Game Development / Newbie & Debugging Questions / Re: Running .jar error main class not found. on: 2014-12-24 14:45:53
What version of Java are you using? What version of Java are your friends using?

You can set the Java compiler to output code that's compatible with older versions of Java. How you do this depends on how you're compiling your code.

Google "java compiler compliance level" for more info.

Simply through the command line. I'll have a look.

You can minimize the JRE but you can't have the cake and eat it.

How small can I make the JRE?
27  Game Development / Newbie & Debugging Questions / Re: Running .jar error main class not found. on: 2014-12-24 13:20:33
The exact problem is that your sister's and your friend's Macs has old version of Java installed. You have to ask them to upgrade their Java installation. If you are still in doubt, provide us a download, I also use a mac, so we can test that.

Well I am not sure whether or not I should still be in doubt so I was asking if specifically those two seemingly unrelated error messages were in fact saying the same thing.
28  Game Development / Newbie & Debugging Questions / Re: Running .jar error main class not found. on: 2014-12-24 12:53:22
Hi

Rather use my own tool (JNDT) to package your game as an .app file or PackR, there is a simple example of use here:
https://gist.github.com/bfontaine/dc9404872ac932755859

Then, your friend will use the JRE packaged with your game and it will work if his Mac isn't too old.

Yeah I would use something like that, but the problem is I want the file size to be small.

But that's definitely an option.

Should I install an older version of java, and then compile?

Also, the error on my sisters mac and my friends mac, read differently. Does anyone know how to explain this?

I guess if there's an exception in thread 'main' then main class can't be found? Iunno?Huh?
29  Game Development / Newbie & Debugging Questions / Re: Running .jar error main class not found. on: 2014-12-24 09:58:15
maybe extra char occurred in manifest: trailing space, \r\n -> \r, eof?

There might have been a newline?

These are the errors I get on a mac:


Exception in thread "main" java.lang.UnsupportedClassVersionError
at java.lang.ClassLoader.defineClass1(Native Method)

at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
30  Game Development / Newbie & Debugging Questions / Re: Running .jar error main class not found. on: 2014-12-23 03:21:51
Could be a case-sensitivity issue? Just speculating... Windows is forgiving of case errors, other OSs aren't.

With the class specified in manifest.txt and the actual name of the class? I don't think so...

Is there some code I can add to record the stacktrace? It's being opened simply by double clicking the jar, the error occurs in a window. (I can't physically use said friends PC, and they can't really be stuffed to mess around opening stuff through the terminal, which can't be blamed really)

Edit: when sister comes over I will use her mac and see if I can find out more

I'll update soon
Pages: [1] 2
 
mercenarius (4 views)
2020-06-04 19:26:01

mercenarius (2 views)
2020-06-04 19:13:43

Riven (850 views)
2019-09-04 15:33:17

hadezbladez (5834 views)
2018-11-16 13:46:03

hadezbladez (2635 views)
2018-11-16 13:41:33

hadezbladez (6251 views)
2018-11-16 13:35:35

hadezbladez (1504 views)
2018-11-16 13:32:03

EgonOlsen (4739 views)
2018-06-10 19:43:48

EgonOlsen (5797 views)
2018-06-10 19:43:44

EgonOlsen (3282 views)
2018-06-10 19:43:20
A NON-ideal modular configuration for Eclipse with JavaFX
by philfrei
2019-12-19 19:35:12

Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04: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!