Skip to main content

Run a class from another Class *PLEASE RESPOND ASAP*

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
1 reply [Last post]
pennypicker9
Offline
Joined: 2013-11-14

How do i make one class run another class. Here's explanation of what i'm asking:

In my code i'm working on, in eclipse Kepler, I made a Password Gui and i want to run my game after you type in the correct password. But both of the codes are in 2 different classes but in the same project.

If i want my game code to run which is named "Game" (Without quotes) After this code where and what would i type?

Heres the code for the "PasswordDemo" class (where it accepts the password if correct and runs correct output):

if (OK.equals(cmd)) { //Process the password.
char[] input = passwordField.getPassword();
if (isPasswordCorrect(input)) {
JOptionPane.showMessageDialog(controllingFrame,
"You are granted access!");

If you need anything else please ask me (I will not give out full code nor code of my Game. thank you if you can help me.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Syed_Naved_Aali
Offline
Joined: 2013-11-28

Your problem gets easily solved by using dynamic class-loader and reflection.