Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
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  
  trivial question, type[] name vs type name[], quicktime messing my comp  (Read 2777 times)
0 Members and 1 Guest are viewing this topic.
Offline Kova

Senior Member





« Posted 2006-04-24 14:20:36 »

Hello ppl.
Forgive me for asking such a noob question, but what is the difference between defining arrays:
"String[] var" and "String var[]" ? I was going crazy for an hour becouse of this....

I wanted to test drawing swing components and tried to made simplest JFrame like this:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
import javax.swing.JFrame;

public class Menu extends JFrame {
   
   public Menu() {
      super("Menu test za Viktoirje");
      setDefaultCloseOperation(EXIT_ON_CLOSE);
       setVisible(true);
   }
   
   public static void main(String args[]) {
      new Menu();
   }
}


...it will compile but when I start it it complains it can't find main class.... I stared and stared and tried everything I can think of (console, classpaths...), nothing! I've looked at main method from my game... it's identical. Finnaly hour later I created new class with eclipse with automaticly generated main and I saw that difference is what I wrote at top of post, array declaration. It works. I thought there's no difference between 2 declarations...
Now I wonder, why the hell my huge game project works just fine with it and this little piece of sh** complains about not finding main??
Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #1 - Posted 2006-04-24 14:38:51 »

String args[]
String []args
String[] args
String[]args (I use this one)

All works and all is the same. This however...

[]String args

doesnt work.

弾幕 ☆ @mahonnaiseblog
Offline Kova

Senior Member





« Reply #2 - Posted 2006-04-24 14:57:51 »

Smiley
somebody please try to compile and run the code I gave then Smiley
I've tried at least 30 times, double checking everything and making sure it is that code that I'm trying to run.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline K.I.L.E.R

Senior Member




Java games rock!


« Reply #3 - Posted 2006-04-24 15:10:40 »

The code is fine.
It compiles fine.

Vorax:
Is there a name for a "redneck" programmer?

Jeff:
Unemployed. Wink
Offline Kova

Senior Member





« Reply #4 - Posted 2006-04-24 15:17:25 »

yes it compiles fine, but have you run it and got the actual frame?

Edit: ok sorry all, I tried it on other computer and works Sad ... something is wrong with my JRE or something Sad
mod can delete this thread, except that my software is screwed up nobody learned anything anyway
Offline jbanes

JGO Coder


Projects: 1


"Java Games? Incredible! Mr. Incredible, that is!"


« Reply #5 - Posted 2006-04-25 18:15:10 »

Edit: ok sorry all, I tried it on other computer and works Sad ... something is wrong with my JRE or something Sad

*sigh*

1  
java -cp . Menu


If you've installed something like Quicktime, it's probably screwing up your classpath. For a more permanent solution, you can track down the Environment Variables in the System Settings. Make sure you DELETE all instances of CLASSPATH from the env vars. Do a simple reboot and you should find that you won't need to use the "-cp" syntax.

Java Game Console Project
Last Journal Entry: 12/17/04
Offline Kova

Senior Member





« Reply #6 - Posted 2006-04-25 18:21:43 »

damn it, I installed QuickTime just day before... I'm gonna uninstall and delete it so hard that best data recovery experts won't find it ever again. Tnx jbanes. All I need was to see a single movie, and to install it you have to install iTunes also... so far no more .mov files for me, no matter how good they are.
Tnx a lot jbanes.
Offline jbanes

JGO Coder


Projects: 1


"Java Games? Incredible! Mr. Incredible, that is!"


« Reply #7 - Posted 2006-04-25 19:27:34 »

I installed QuickTime just day before... I'm gonna uninstall and delete it so hard that best data recovery experts won't find it ever again.

That won't fix your problem. Just leave iTunes installed, right click on "My Computer", go to "Properties", select "Advanced", click on "Environment Variables", and delete "CLASSPATH" from both boxes. That will fix your problem. This is especially good to keep in mind because Quicktime is FAAAAAAR from the only program that will screw with your Java classpath.

Java Game Console Project
Last Journal Entry: 12/17/04
Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #8 - Posted 2006-04-25 19:48:28 »

>right click on "My Computer", go to "Properties"

<win>+<break> Wink

Btw there is also Quicktime Alternative, which isnt that much of a pain in the rear.

弾幕 ☆ @mahonnaiseblog
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #9 - Posted 2006-04-25 19:56:57 »

Why in the name of all things unholy does Quicktime mess with the classpath? Shocked

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Kova

Senior Member





« Reply #10 - Posted 2006-04-25 20:09:52 »

After uninstalling quicttime I don't have classpath variable anymore... but some (or all) problem remains. Now all my exceptions look like this:

Exception in thread "main" java.lang.NullPointerException
   at viktorije.Viktorije.<init>(Unknown Source)
   at viktorije.Viktorije.main(Unknown Source)

...instead of filename and line number I get unknown source, I think it's related to quicktime screwing my computer. Any suggestions about this?
Offline jbanes

JGO Coder


Projects: 1


"Java Games? Incredible! Mr. Incredible, that is!"


« Reply #11 - Posted 2006-04-25 20:31:57 »

Why in the name of all things unholy does Quicktime mess with the classpath? Shocked

Quicktime for Java, of course.

Quote
...instead of filename and line number I get unknown source, I think it's related to quicktime screwing my computer. Any suggestions about this?

That's your compiler settings, not QT. You need to leave the debugging info ON if you want line numbers. Otherwise they'll get stripped out. If the program isn't yours, the author probably did this to reduce the size of his code.

Stop worrying about Quicktime. It didn't do anything major to your computer. All it did was add a classpath entry so that you could use QTJava. Now that the classpath entry is gone, its influence has dissapated. The remainder is all about educating yourself. In fact, you'd do well to learn all about what the ClassPath is, and how it works.

Java Game Console Project
Last Journal Entry: 12/17/04
Offline Kova

Senior Member





« Reply #12 - Posted 2006-04-25 20:38:32 »

eh sorry... I got really mad at quicktime, it has taken me hours of time and my nerves...  Those line numbers, it's my fault, when I tried to fix the situation while I had QT installed I've tried to change everything in hope of solution... this part I forgot to turn on after.
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #13 - Posted 2006-04-25 22:33:01 »


Ah, silly me, I thought this was Quicktime the player, not some kind of API for it. Embarrassed

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline jbanes

JGO Coder


Projects: 1


"Java Games? Incredible! Mr. Incredible, that is!"


« Reply #14 - Posted 2006-04-26 03:35:55 »

Ah, silly me, I thought this was Quicktime the player, not some kind of API for it. Embarrassed

The API is bundled with the player. So it's sort of both. Smiley

Java Game Console Project
Last Journal Entry: 12/17/04
Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #15 - Posted 2006-04-26 05:33:21 »

Ah, silly me, I thought this was Quicktime the player, not some kind of API for it. Embarrassed

The API is bundled with the player. So it's sort of both. Smiley

Yeah, that part Apple got right... if you use Quicktime for Java you can just say to users "you need quicktime" and your Java app is supposed to "just work".
But sadly there is no safe place to install the QT4J jars on Windows such that it is included in the classpath and will survive updates to the JRE.  (Unlike Mac OS X where Apple put some thought into the classpath and provided a global extensions folder and a per-user extensions folder.)
...So they go and bugger up the classpath variable.  You would think that they would fix it to keep '.' in the classpath at least.

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.

E.R. Fleming (20 views)
2014-07-29 03:07:13

E.R. Fleming (7 views)
2014-07-29 03:06:25

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

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

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

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

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

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

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

MustardPeter (45 views)
2014-07-16 23:30:00
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!