317 Client - How do I run a client with a src folder? (Java noob)

Hey guys,

I have a client that I want to run but its one src folder with subfolders like com, runescape, net, etc. There’s no .bat file to run it and I’m not sure what classpath to add to a .bat if I were to make one ;s I dont even know what class the client runs off. Can someone tell me what to do please?

Thank you!

Client? Just compile it with all the classpaths. Clients main method is usually located in the class named client.

Okay, so let me get this straight: I am supposed to have a .bat file? Because if so, when I click on it, nothing happens. O.o

If there’s an “src” folder, then there must also be a “bin” folder (If not the person that set this client up is stupid…)

src stands for “Source” - aka, where the source code is. Source code does not get ran in Java. You must first compile it into binaries called class files (.class is the extension).

“bin” stands for - you guessed it - binaries. This is where your compiled and runnable code will be.

There is no .bat file because the previous owner used an IDE like Eclipse. (There are many, many others, search google for “Java IDE” if you don’t like eclipse)

To run the client you have two options:

  1. Download and use an IDE - Recommended. There are 100000 tutorials on how to use IDEs; just a simple google search away.

  2. Create the .bat file yourself.
    This would be easy for someone experienced with Java and someone that knows what bat files are/how to use them. That is why I suggest you to do the first option (Also is why that is the first option).
    To create the >working< bat file you need to place specific arguments into it. First being, the program you’re running (Java).
    Then - each program can have it’s own arguments. In Java’s case, there’s PLENTY.
    I’m not going to go in-depth over this - as that would take at least an hour just to write.
    But this guy does a good explanation over the subject: DOS batch files to compile and run a Java program (and create a jar file)

[quote=“sk8rdude461, post:4, topic:554066”]If there’s an “src” folder, then there must also be a “bin” folder (If not the person that set this client up is stupid…)

src stands for “Source” - aka, where the source code is. Source code does not get ran in Java. You must first compile it into binaries called class files (.class is the extension).

“bin” stands for - you guessed it - binaries. This is where your compiled and runnable code will be.

There is no .bat file because the previous owner used an IDE like Eclipse. (There are many, many others, search google for “Java IDE” if you don’t like eclipse)

To run the client you have two options:

  1. Download and use an IDE - Recommended. There are 100000 tutorials on how to use IDEs; just a simple google search away.

  2. Create the .bat file yourself.
    This would be easy for someone experienced with Java and someone that knows what bat files are/how to use them. That is why I suggest you to do the first option (Also is why that is the first option).
    To create the >working< bat file you need to place specific arguments into it. First being, the program you’re running (Java).
    Then - each program can have it’s own arguments. In Java’s case, there’s PLENTY.
    I’m not going to go in-depth over this - as that would take at least an hour just to write.
    But this guy does a good explanation over the subject: DOS batch files to compile and run a Java program (and create a jar file)[/quote]

Thanks so much for the reply! There was in fact no bin folder, so I ran the client in eclipse and it came up with errors but at least it compiled and made a bin folder. I assume the class to run would be the largest one, called “Game” with 30kb. I made a .bat for it and I get a "Exception in java thread “main” java.lang.NoClassDefFoundError: Game (wrong name: com/jagex/runescape/Game) at blah blah blah. Could you please tell me what I did wrong? Thank you :slight_smile:

Instead of assuming the biggest one contains the main method you should just search which class contains it. To aid with your problem please post the line that you run your client with. Also when you ask for help on a problem it would probably be the best for you to put in the entire exception.

[quote=“Demogorgon, post:5, topic:554066”][quote author=sk8rdude461 link=topic=672987.msg4500396#msg4500396 date=1449780565]
If there’s an “src” folder, then there must also be a “bin” folder (If not the person that set this client up is stupid…)

src stands for “Source” - aka, where the source code is. Source code does not get ran in Java. You must first compile it into binaries called class files (.class is the extension).

“bin” stands for - you guessed it - binaries. This is where your compiled and runnable code will be.

There is no .bat file because the previous owner used an IDE like Eclipse. (There are many, many others, search google for “Java IDE” if you don’t like eclipse)

To run the client you have two options:

  1. Download and use an IDE - Recommended. There are 100000 tutorials on how to use IDEs; just a simple google search away.

  2. Create the .bat file yourself.
    This would be easy for someone experienced with Java and someone that knows what bat files are/how to use them. That is why I suggest you to do the first option (Also is why that is the first option).
    To create the >working< bat file you need to place specific arguments into it. First being, the program you’re running (Java).
    Then - each program can have it’s own arguments. In Java’s case, there’s PLENTY.
    I’m not going to go in-depth over this - as that would take at least an hour just to write.
    But this guy does a good explanation over the subject: DOS batch files to compile and run a Java program (and create a jar file)
    [/quote]

Thanks so much for the reply! There was in fact no bin folder, so I ran the client in eclipse and it came up with errors but at least it compiled and made a bin folder. I assume the class to run would be the largest one, called “Game” with 30kb. I made a .bat for it and I get a "Exception in java thread “main” java.lang.NoClassDefFoundError: Game (wrong name: com/jagex/runescape/Game) at blah blah blah. Could you please tell me what I did wrong? Thank you :)[/quote]
One problem is; your client is packaged. So when making a bat file, you cannot refer to the main class as simply “Game” if it is in the package com.jagex.runescape. You would actually have to refer to it as com.jagex.runescape.Game.
Also, did you make sure to run the client in Eclipse first? It will automatically search for a main class, and display the ones that exist. That would help you figure out which is the actual one - instead of guessing (Though you may have to guess between the ones listed).

[quote=“sk8rdude461, post:7, topic:554066”][quote author=Demogorgon link=topic=672987.msg4500429#msg4500429 date=1449820882]

Thanks so much for the reply! There was in fact no bin folder, so I ran the client in eclipse and it came up with errors but at least it compiled and made a bin folder. I assume the class to run would be the largest one, called “Game” with 30kb. I made a .bat for it and I get a "Exception in java thread “main” java.lang.NoClassDefFoundError: Game (wrong name: com/jagex/runescape/Game) at blah blah blah. Could you please tell me what I did wrong? Thank you :slight_smile:
[/quote]
One problem is; your client is packaged. So when making a bat file, you cannot refer to the main class as simply “Game” if it is in the package com.jagex.runescape. You would actually have to refer to it as com.jagex.runescape.Game.
Also, did you make sure to run the client in Eclipse first? It will automatically search for a main class, and display the ones that exist. That would help you figure out which is the actual one - instead of guessing (Though you may have to guess between the ones listed).[/quote]

Alright well when I try to run the client in eclipse as a java application I get this:

Exception in thread “main” java.lang.NoClassDefFoundError: Widget
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.getMainMethod(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: Widget
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
… 6 more

Could you please tell me what to do with this? I cant find a class called Widget.

Well, not being able to find a class called “Widget” is exactly why you got the error you did, actually.
“NoClassDefFoundError” means it cannot find a class for the item defined.

Due to the source of the error being unknown, this makes it a bit harder to solve.
What does the getMainMethod() for LauncherHelper and checkAndLoadMain() for LauncherHelper methods contain?

[quote=“sk8rdude461, post:9, topic:554066”]Well, not being able to find a class called “Widget” is exactly why you got the error you did, actually.
“NoClassDefFoundError” means it cannot find a class for the item defined.

Due to the source of the error being unknown, this makes it a bit harder to solve.
What does the getMainMethod() for LauncherHelper and checkAndLoadMain() for LauncherHelper methods contain?[/quote]
I’m sorry but I have no idea what you’re asking for ;s I dont know java enough to know where to look for those things.

[quote=“sk8rdude461, post:9, topic:554066”]Well, not being able to find a class called “Widget” is exactly why you got the error you did, actually.
“NoClassDefFoundError” means it cannot find a class for the item defined.

Due to the source of the error being unknown, this makes it a bit harder to solve.
What does the getMainMethod() for LauncherHelper and checkAndLoadMain() for LauncherHelper methods contain?[/quote]

They are unknown source so he doesn’t have source code specified nearby but here’s the code:
http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8u40-b25/sun/launcher/LauncherHelper.java?av=f

[quote=“Demogorgon, post:8, topic:554066”]Alright well when I try to run the client in eclipse as a java application I get this:

Exception in thread “main” java.lang.NoClassDefFoundError: Widget
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.getMainMethod(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: Widget
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
… 6 more

Could you please tell me what to do with this? I cant find a class called Widget.[/quote]

You can’t find a ‘class’ called Widget? Do you have a source for the class Widget?

[quote=“Paavo123, post:11, topic:554066”][quote author=sk8rdude461 link=topic=672987.msg4500457#msg4500457 date=1449868640]
Well, not being able to find a class called “Widget” is exactly why you got the error you did, actually.
“NoClassDefFoundError” means it cannot find a class for the item defined.

Due to the source of the error being unknown, this makes it a bit harder to solve.
What does the getMainMethod() for LauncherHelper and checkAndLoadMain() for LauncherHelper methods contain?
[/quote]

They are unknown source so he doesn’t have source code specified nearby but here’s the code:
http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8u40-b25/sun/launcher/LauncherHelper.java?av=f

You can’t find a ‘class’ called Widget? Do you have a source for the class Widget?[/quote]

No, I searched the whole src folder for it and it’s not there. It’s Cyberus’s refactored 317 client, and I cant figure out how to run the damn thing :confused: its on rune-server . org /runescape-development/rs2-client/projects/471067-refactored-317-a . html

Well I can’t download it since I don’t have a registered user on rune-server but from what I can see it looks like an unfinished project. I recommend you just find yourself a working project from someone.

Demogorgon, add me on skype @ eyeownyew. Usually helping entirely new people but you seem like you’re pretty intelligent and just having a difficult time getting it off the ground – no worries, totally understandable. I’d be happy to help you understand more about how to get your server off the ground and programming as a whole, but it would be way easier to explain things through a messenger like skype