Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
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  
  javac and -sourcepath  (Read 1302 times)
0 Members and 1 Guest are viewing this topic.
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 742
Projects: 4
Exp: 16 years


Hand over your head.


« Posted 2006-12-12 23:35:37 »

Long time since I compiled my java-files manually to classes.

These are the classes:
my.stuff.City
my.stuff.Factory

In these files:
C:/somewhere/my/stuff/City.java
C:/somewhere/my/stuff/Factory.java

Now it's dead-easy to compile this:
C:/somewhere/> javac my/stuff/City.java my/stuff/Factory.java

But here's the catch, the current directory is NOT C:/somewhere, but it's C:/

According to the javac-documentation I should do this:
C:/>javac -sourcepath C:/somewhere my/stuff/Factory.java

error: cannot read: my/stuff/Factory.java
...


Doesn't work. I tried just about everything I could think of, but I only manage to compile it if the current-directory is the root of the package Angry

This is a documented feature, what am I doing wrong?

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

Senior Member





« Reply #1 - Posted 2006-12-13 18:40:38 »

According to the javac-documentation I should do this:
C:/>javac -sourcepath C:/somewhere my/stuff/Factory.java

error: cannot read: my/stuff/Factory.java
...

Are you sure you got dir name right? It sounds like a typo, like it should be C:/somewhere/my stuff/ ... or C:/somewhere/my/stuff/ ...
and if you are working in windows use backslashes.

EDIT: oh you listed where files are ... then it's just a missing slash in your source path argument
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 742
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #2 - Posted 2006-12-13 19:24:53 »

Me: " I tried just about everything I could think of, "

I'd suggest you try it for yourself, there is no way it works Angry

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #3 - Posted 2006-12-13 19:32:05 »

C:/>javac -sourcepath C:/somewhere somewhere/my/stuff/Factory.java

The path to the source files is relative to your current location, even though you specified the source path. However, if Factory.java imports some other classes, it will find the sources (because of -sourcepath).


Offline Riven
« League of Dukes »

JGO Overlord


Medals: 742
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #4 - Posted 2006-12-13 21:56:44 »

Thanks!

Imagine java.exe worked like that Shocked

java -classpath myDirectory/workspace myDirectory/workspace/my.package.MyClass


I know how it works now, but it's far from intuitive.

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 #5 - Posted 2006-12-14 10:00:14 »

Imagine java.exe worked like that Shocked

java -classpath myDirectory/workspace myDirectory/workspace/my.package.MyClass

Heh, the only difference is that javac takes the path to the source files(s) as argument, java.exe takes the class name as argument, which kind of makes sense to me...
Your example is a mix of both and is just weird  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.

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

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

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

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

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

Riven (48 views)
2014-07-14 18:02:53

OpenGLShaders (38 views)
2014-07-14 16:23:47

Riven (37 views)
2014-07-14 11:51:35

quew8 (33 views)
2014-07-13 13:57:52

SHC (70 views)
2014-07-12 17:50:04
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!