Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (120)
games submitted by our members
Games in WIP (577)
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  
  Accessing classes  (Read 1238 times)
0 Members and 1 Guest are viewing this topic.
Offline alexxz4

Junior Duke


Projects: 1



« Posted 2008-02-16 22:53:23 »

I have a folder with a bunch of classes next to my main class. How would i access those classes? Is it possible?
Thnx

[ Motherload Unlimited looking for programmers ] [ Solitaire ]
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #1 - Posted 2008-02-16 22:55:44 »

Usually one would use packages. Other than that that directory could be added to the class path.

弾幕 ☆ @mahonnaiseblog
Offline alexxz4

Junior Duke


Projects: 1



« Reply #2 - Posted 2008-02-16 23:06:56 »

Hmmm... it works when this folder is in the same derictory as the main class. But it doesnt work when the folder is in a JAR. I have to place all those classes next to the main class inside the JAR then it works.

[ Motherload Unlimited looking for programmers ] [ Solitaire ]
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #3 - Posted 2008-02-17 01:25:32 »

Well, use packages or just put em all into the same directory.

弾幕 ☆ @mahonnaiseblog
Offline alexxz4

Junior Duke


Projects: 1



« Reply #4 - Posted 2008-02-17 01:39:24 »

Oh... ok. Im better at summersaulting than using packages, but thanx anyway. It shouldnt affect performance if all those classes are put in this ugly fashion, should it?

[ Motherload Unlimited looking for programmers ] [ Solitaire ]
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #5 - Posted 2008-02-17 02:08:44 »

Using packages is pretty easy. I recommend to look that up online.

Putting everything into one directory or not doesn't affect performance in a measurable way. It should be faster actually, but constructing a benchmark where that actually makes a difference should be pretty much impossible.

The only purpose of packages is organization and avoiding naming conflicts. (Well, there is also that package access modifier, but it's rarely used.)

弾幕 ☆ @mahonnaiseblog
Offline alexxz4

Junior Duke


Projects: 1



« Reply #6 - Posted 2008-02-17 02:19:19 »

Whenever i try using packages, Java starts "losing" classes. Once i tried using EasyOgg package and it didnt work, so i ended up extracting all the stuff and putting it next to main class. Ugly but works.  Roll Eyes

[ Motherload Unlimited looking for programmers ] [ Solitaire ]
Offline aldacron

Senior Duke


Medals: 9
Exp: 16 years


Java games rock!


« Reply #7 - Posted 2008-02-17 04:39:48 »

Whenever i try using packages, Java starts "losing" classes.

As part of learning to use packages, you need to learn how to set up the classpath. Once you understand that, it's smooth sailing.
Offline Mr_Light

Senior Duke


Medals: 1


shiny.


« Reply #8 - Posted 2008-02-18 22:09:02 »

Putting everything into one directory or not doesn't affect performance in a measurable way. It should be faster actually, but constructing a benchmark where that actually makes a difference should be pretty much impossible.
actually probably dependent on the amount of classes, the filesystem used etc. It would be pretty non-effective premature optimization. I'll shutup now Smiley

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.
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.

theagentd (11 views)
2014-10-25 15:46:29

Longarmx (52 views)
2014-10-17 03:59:02

Norakomi (45 views)
2014-10-16 15:22:06

Norakomi (34 views)
2014-10-16 15:20:20

lcass (38 views)
2014-10-15 16:18:58

TehJavaDev (68 views)
2014-10-14 00:39:48

TehJavaDev (68 views)
2014-10-14 00:35:47

TehJavaDev (60 views)
2014-10-14 00:32:37

BurntPizza (73 views)
2014-10-11 23:24:42

BurntPizza (45 views)
2014-10-11 23:10:45
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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
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!