Bill Cruise

Ranch Hand
+ Follow
since Jun 01, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Bill Cruise

I don't see why you would get java.lang.ClassNotFoundException. Was your Basic class in a file named "Basic.java"?

The code you've posted won't compile because you're calling a non-static method, method(), from the static context of main. Please check to make sure you've posted the exact same code that you're running.
12 years ago
In a pretty similar fashion.



javadoc
12 years ago
Sounds like you're concatenating the first two strings together. "1" + "2" = "12".
Make sure you convert them to numbers before applying the + operator to strings, if addition is what you intend.
Paul, it's not where the JRE is installed (that's the user's JRE, and none of my business anyway). It's where the user is at when he launches the application that I want to know.
12 years ago
I found the answer.


gives the current working directory where the JVM was launched from.
12 years ago
I want to bring up a file dialog that defaults to my Java application's install directory. Is there a way to get that information from the system?
12 years ago
Terry, I'm not sure if this will help, but here's how encrypted passwords are typically handled.

1. Store the user's login name and encrypted password.
2. When the user logs in, collect their username and password.
3. Encrypt the supplied password with the same algorithm as in step #1.
4. Compare the two encrypted strings to see if they are the same.

This is greatly simplified, and of course I'm leaving out salting your password, which you should do, but this should give you the basic idea.
12 years ago
The reason you subtract one from the array length is so you don't go off the end of the array. Array indices in Java go from zero to length-1 by design, so an array with a size of ten elements will index those elements by the integers 0-9.
12 years ago
I think Java for the Mac is currently stuck at version 1.5, but you'd have to check to be sure. So if you want your application to be compatible you'd just have to make sure to use the Java 1.5 JDK (and test it on a Mac, of course).
12 years ago
You need to translate the image either right before or right after you rotate it. In the code that I started with, call:

trans.translate(x, y);

Where x and y are the amount you want to move the image. I'd start with the width and height of your image and play around from there to see how it works.
12 years ago
It sounds like you want to look in to using digital certificates. You can look into OpenSSL or Java's Keytool for information on how to make them. Basically, they're an encrypted file that the user can't change without invalidating. They also have an optional expiration date that you can set to any arbitrary limit. Then, you have to write your software so that it looks for a valid, unexpired certificate before it will run. You can look into the JCE and JSSE packages for information on how to do this.
12 years ago
Without looking for problems anywhere else, I see that this line

while (c <= 4000000);

loops forever. Remove that semicolon and try it again.
12 years ago
You've declared int var as a local variable in the constructor of the one class, so once that constructor finishes running the variable is out of scope. Try making it an instance variable (declare it outside your constructor) and you should have better luck.
12 years ago
You'd want to load more image before you reach the edge, wouldn't you?
The way scrollable backgrounds are normally implemented is by drawing in image tiles. Each tile is stored in a 2D array, and every time your character moves, new tiles are loaded, and old ones are thrown out.

Amazon happens to have two good programming books bundled together that I recommend for anyone getting in to game programming in Java here (see the "better together" section). If you're only going to get one book, I recommend "Killer Game Programming in Java".
12 years ago
Hello, Rayln. Welcome to Java Ranch.

You can display 3D graphics in Java too. I know of one online tutorial and there are plenty of
books available.
12 years ago