Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (533)
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  
  Switching to a real IDE (NetBeans) help me =)  (Read 2463 times)
0 Members and 1 Guest are viewing this topic.
Offline Cero
« Posted 2009-04-13 00:47:11 »

Even tho my project is pretty elaborate, I took JCreator till now
Now I wanna switch to NetBeans.
Only problem is with the packages

I have 3 packages, folder with class files which should be imported

all my project java and class files are in the same directory, and in that same directory there are of course directories containing game content and the packages I need. Those are in a directory called "com" as it is done often.

So I have this com directory in which everything is included and fine, and it works in JCreator of course, but in NetBeans I cannot make him understand that he should use them / I dont know where to put them.

He goes on like package xy doesnt exists

one example of course is in my OggClip class "import com.jcraft.jogg.Packet;"
something like that

... how you do this in a real IDE ?

Offline bienator

Senior Member




OutOfCoffeeException


« Reply #1 - Posted 2009-04-13 02:20:25 »

the standard NetBeans ANT driven java project has the following structure:

<project name>/
./src (contains .java source files, may also contain content (images etc))
./build (destination folder for .class files and everything else you need to run the app, managed automatically)
./dist (destination folder for a full project build e.g jar, pack, sign etc)
./nbproject (build script and project properties)
./lib (additional jars)

NetBeans will automatically copy all files from src to the build folder except those on the ignore list (default on the list is .java and .form).

To successfully build your project in NetBeans with similar results like before you should try the following steps:
1. copy your sources  (java, images etc) to the src folder
2. remove all .class files in the src folder (this one is important)
3. right click on the project -> Build -> Packaging -> remove **/*.java, in the "Exclude from jar file text field"
4. build your project

step 3 is only needed if you really want to ship your java source files side by side with your class files.

if you have your data in a separate folder just add this folder as additional source folder to the project (again via project properties window). From now on the content in the data folder should be automatically copied to the build dir on build and therefore also bundled in the jar.

hope that helps

Offline Mr_Light

Senior Member




shiny.


« Reply #2 - Posted 2009-04-14 16:05:48 »

Since visualvm I pretty much haven't used netbeans perhaps a gui mockup here and there, anyway

Isn't there a import project thing or add folders as source folder..

I'd be surprised if netbeans wouldn't be able to adapt to your own directory structure..


If all else fails define a pom.xml with your directory structure and use netbeans maven support (I've heard it's excellent)

It's harder to read code than to write it. - it's even harder to write readable code.

The gospel of brother Riven: "The guarantee that all bugs are in *your* code is worth gold." Amen brother a-m-e-n.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Cero
« Reply #3 - Posted 2009-04-14 17:36:49 »

main problem is i just cannot include my com folder, my additional packages, which are not jars

I put it now for exmaple in the lib folder, but of course it didn't help

where exactly do I have to add those folders, or just the com folder whatever




Offline Cero
« Reply #4 - Posted 2009-04-14 17:37:49 »

btw I would also use Eclipse but I thought it would be even harder to set up =P

Offline Json

Junior Member


Exp: 7 years



« Reply #5 - Posted 2009-04-14 17:41:09 »

I'm no Netbeans user myself but I'd have thought you should put your com folder in the src directory.

// Json
Offline Cero
« Reply #6 - Posted 2009-04-14 18:24:53 »

nah I tried that multiple times... remember there are only class files in it

like it is shown in the screenshot

Offline Jackal von ÖRF

Junior Member





« Reply #7 - Posted 2009-04-14 19:08:36 »

Zip the .class files (so that the "com" directory is in the root) and rename the .zip into .jar. That's how libraries are usually used. (Maybe NetBeans supports also unpacked libraries, at least IDEA does, but if it doesn't seem to work, don't waste too much time in getting it to work.)

Offline bienator

Senior Member




OutOfCoffeeException


« Reply #8 - Posted 2009-04-14 19:30:00 »

main problem is i just cannot include my com folder, my additional packages, which are not jars

i don't understand. "Add Jar/Folder" to compile classpath in project properties doesn't work for you?

Offline Gudradain
« Reply #9 - Posted 2009-04-14 21:48:20 »

If you want to use .class they need to be in the build folder. So if you put all your stock in the build folder than press compile it will probably work. Unfortunately, in the build folder they are not permanent because all the build folder get clear when you click "Clean and build main project", that mean you need to manually reput your stock in it...

But really, the "Add jar/folder..." command when you right click on the Libraries folder in the project work great. Use it.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline h3ckboy

JGO Coder


Medals: 5



« Reply #10 - Posted 2009-04-14 21:53:13 »

hehe, this is another example of why little IDE are good.

the smaller the easier, granted less organized, but still easier.
Offline Gudradain
« Reply #11 - Posted 2009-04-14 22:35:43 »

hehe, this is another example of why little IDE are good.

the smaller the easier, granted less organized, but still easier.

I first learn java with DrJava and I thought at this time that it was the best tool to code. But now I'm using Eclipse and Netbeans and there is no way I will go back to DrJava.
Offline h3ckboy

JGO Coder


Medals: 5



« Reply #12 - Posted 2009-04-14 22:45:23 »

ignorance is bliss  Cool
Offline Hsaka
« Reply #13 - Posted 2009-04-15 00:17:38 »

You will need to wrap up your com folder (with the .class files) in a jar file as suggested here:
Quote
Zip the .class files (so that the "com" directory is in the root) and rename the .zip into .jar.

Then just import the jar file into your netbeans project.

Quote
If you want to use .class they need to be in the build folder. So if you put all your stock in the build folder than press compile it will probably work.

You can't do this because the .class files produced in the build folder are a result of the compile process.
Offline Cero
« Reply #14 - Posted 2009-04-15 00:30:32 »

hehe, this is another example of why little IDE are good.

the smaller the easier, granted less organized, but still easier.

Absolutely.


Quote
i don't understand. "Add Jar/Folder" to compile classpath in project properties doesn't work for you?

Nope, look what happens




Also I tired putting it in the build folder aswell but I also doesn't work x)

Offline Cero
« Reply #15 - Posted 2009-04-15 00:41:55 »

ok I just tried the same just by zipping it as jar
and know it works... I fail to see the point =)

Offline cylab

JGO Ninja


Medals: 38



« Reply #16 - Posted 2009-04-15 00:54:02 »

You just would have needed to add the folder with the class files (the one above the com folder) as a library via the project properties [Add Jar/Folder] button in the libraries category. That's all.

Mathias - I Know What [you] Did Last Summer!
Offline Cero
« Reply #17 - Posted 2009-04-15 02:03:21 »

You just would have needed to add the folder with the class files (the one above the com folder) as a library via the project properties [Add Jar/Folder] button in the libraries category. That's all.

I did exactly that. With the folder it just wouldn't work, but as a jar it did

Offline Gudradain
« Reply #18 - Posted 2009-04-15 02:08:08 »

I did exactly that. With the folder it just wouldn't work, but as a jar it did

The problem was probably that you put the com folder directly in the lib. You need to put the com in another folder then putting this folder in the lib.

By making a jar you basically did the same thing.
Offline Cero
« Reply #19 - Posted 2009-04-15 03:18:56 »

Now I get it, thanks

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.

pw (24 views)
2014-07-24 01:59:36

Riven (24 views)
2014-07-23 21:16:32

Riven (18 views)
2014-07-23 21:07:15

Riven (21 views)
2014-07-23 20:56:16

ctomni231 (50 views)
2014-07-18 06:55:21

Zero Volt (45 views)
2014-07-17 23:47:54

danieldean (36 views)
2014-07-17 23:41:23

MustardPeter (39 views)
2014-07-16 23:30:00

Cero (54 views)
2014-07-16 00:42:17

Riven (55 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!