Error running old programs
IE: java xxxx gives me a class not found error. OK, restart. Same error. The programs I'm running I've run hundreds of times before. Java doesn't recognize any java classes actually. I'm going to reinstall, but has anyone run into this before? Oh yeah, I'm running 1.3. ( Reinstalling the latest one). Thanks in advance.
Goddammit. I just wrote a reply, and clicked preview and closed the window without posting. Grrr...
Anyway, I had the same problems with IE. You need to disable Sun Java:
Tools -> Internet Options -> Advanced
Scroll down to "Java (Sun)"
Disable the checkbox "Use Java 2 v1.4.1_02 for <applet> (requires restart)
And ignore it, it doesn't require a restart (at least not for me). If the box is checked (using Sun Java), most applets don't work. I uncheck it, they all work.
HTH,
Radish21
Similar Messages
-
Error running java program (testing oracle-character-set-31 against ab?c )
Hi
When i run my java program from eclipse , i get these errors : how to correct these errors and run the program
testing oracle-character-set-31 against <ab?c>
PASSED LOSSY
testing oracle-character-set-31 against <XYZ>
PASSED LOSSY
testing oracle-character-set-31 against <longlonglonglong...>
PASSED LOSSY
testing oracle-character-set-870 against <abc>
PASSED
testing oracle-character-set-870 against <ab?c>
PASSED
testing oracle-character-set-870 against <XYZ>
PASSED
testing oracle-character-set-870 against <longlonglonglong...>
PASSED
testing oracle-character-set-871 against <abc>
PASSED
testing oracle-character-set-871 against <ab?c>
PASSED
testing oracle-character-set-871 against <XYZ>
PASSED
testing oracle-character-set-871 against <longlonglonglong...>
PASSEDrxg wrote:
Hi
When i run my java program from eclipse , i get these errors : how to correct these errors and run the program
...Sun's not Oracle (yet). You will have better luck on a forum relating to whatever is producing that "oracle-character-set..." output.
Edit:
Although a Google search for "testing oracle-character-set" yields only this thread. Are you sure that output isn't part of your program?
Edited by: endasil on 7-Oct-2009 3:40 PM -
Subscribing to Creative Cloud vs. running old programs
Hello,
I'm currently running Adobe CS 4 / 5 Design Premium. If I would subscribe to the Creative Cloud Membership at the special price offer, would I still be able to run my old programs like Illustrator CS4 and CS5? I work as a Freelancer for a huge printing companywith thousands of Freehand files. Since Adobe stopped supporting Freehand files I need to run the older software or I can't work for my big customer. How is the situation running old CS Suites vs. subscribing to creative cloud?You can run both CS4/CS5 and CS6 all together on your machine.
-
Another question about running old programs on new macs
I'm a little confused and was wondering if someone can help me out.
From what I've read I cannot find any options for me to run an old programs for OS with my intel-based MacBook. Just in case I've tried downloading a bunch of different things (OS 9.2.2 which won't run, sheepshaver which I can't figure out how to use even it it might work). IS there anything that I can do?Welcome to Apple Discussions!
1. Buy an older PowerPC Mac used or refurbished as my FAQ* explains how to do:
http://www.macmaps.com/usedrefurbished.html
2. Contact the developer of the said software and ask a Mac OS X version be published of their software.
3. Politely ask Apple develop a virtualization program through AppleCare's Customer Relations department, http://www.apple.com/macosx/feedback/ and if you want a free developer account go to http://bugreporter.apple.com/ and submit it as an enhancement request.
4. Tell us what software you want to run that you found is 9 only, and maybe we can tell you an alternative that can open the same documents, play the same style game that is Mac OS X native, or will run under Windows or Linux on your Mac?
- * Links to my pages may give me compensation.
Message was edited by: a brody -
c:>java HelloClient
Exception in thread "main" java.lang.NoClassDefFoundError: weblogic/logging/LogO
utputStream
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:124)
at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialCont
extFactory.java:118)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
71)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:242
at javax.naming.InitialContext.init(InitialContext.java:218)
at javax.naming.InitialContext.<init>(InitialContext.java:194)
at HelloClient.main(HelloClient.java:17)
I am gettting the following error when run the client program
i am using weblogic 5.1
the code is HelloClient.java
import java.rmi.RemoteException;
import java.util.Properties;
import javax.ejb.CreateException;
import javax.ejb.RemoveException;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;
public class HelloClient {
public static void main(String [] args) {
try {
Properties props=new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
props.put(Context.PROVIDER_URL,"t3://localhost:7001");
InitialContext ctx = new InitialContext(props);
Object ref = ctx.lookup("helloBean.HelloHome");
HelloHome hello1 =
(HelloHome)PortableRemoteObject.narrow(ref,HelloHome.class);
Hello1 helloHome = hello1.create();
String message = helloHome.getMessage();
System.out.println("messsage from Bean====" +message);
// helloHome.remove(); //clean up
catch (NamingException ne){
ne.printStackTrace();}
catch (Exception exception) {
System.err.println("Exception!");
exception.printStackTrace();}
Hello1 is remote interface
HelloHome is home inteerface
the bean is deployed
anyone please help
i hava added c:\weblogic\classes\weblogic\logging in classs path
but the same problem occured.Try addinging weblogic.jar to the classpath.
-
Hi guys, new to the forum here, just as I'm new to Java. I'm trying to get my Java environment running, but everytime I execute the code, I get an error message saying
"Exception in thread "main" java.lang.NoClassDefFoundError: TestJavaEnvironment"
If anyone has any ideas what I'm doing wrong, I'd greatly appreciate it, got some homework for a class I'm taking, but talk about stumbling out of the gate. Anyways, thanks in advance.Assuming that you have created a file named
"TestJavaEnvironment.class", change to the directory that contains it. From that directory issue the following command:
java -cp . TestJavaEnvironment
Important: include the period and the surrounding spaces. -
Error running RMI program in Linux
hi,
hope can get some advices and help from you all..my problems is like this:
There is no problem when i run my RMI client in Windows to send message to server. but when i run my RMI client in Linux to send message to server, exception occurs..here are the source codes...
****interface Task2*****
public interface Task2 extends Serializable {
Object getSender();
Object getReceiver();
Object getText();
}****sdMssg.class********
public class sdMssg implements Task2{
Sring sender, receiver, text;
public sdMssg(String s, String r, String t) {
sender = s;
receiver = r;
text = t;
public Object getSender(){
return sender;
public Object getReceiver(){
return receiver;
public Object getText(){
return text;
}when i click "send" in my message box,
public void actionPerformed(ActionEvent e){
if(e.getActionCommand().equals("Send")){
try{
String input = lsd2.getText(0, lsd2.getLength());
String mssg = new String(sender.getText()+": ");
mssg = mssg.concat(input);
try{
sdMssg task = new sdMssg(sender.getText(), receiver.getText(), mssg);
uL.sendMessage(task); //uL is the reference to the remote
//object.sendMessage is remote
//method to send task object to
//server
}catch(Exception ex){
ex.printStackTrace();
lsd.insertString(lsd.getLength(), mssg + newline, attrs);
lsd2.remove(0, lsd2.getLength());
}catch(BadLocationException ex){}************************************************************************
the exception : java.lang.NullPointerException() at line uL.sendMessage(task)..do you know what is the problem? it's running very well in Windows but not in Linux..what should i do? i really need yours help..
Thanks a lot here..sorry, it's my mistake..it really Naming.lookup problem..i have solved it..anyway, thanks for your kindness..
-
Error :No operating system credentials were set for running the program
i am getting this error when i am trying to execute a shell script in cmc. i got the status as failed, when clicked on that failed message this is what i got
Title: delete_month
Document Type: Program
Status Failed
Destination: Unmanaged Disk destination properties have been set to the chosen Job Server's defaults.
Owner: boadmin
Server Used: cms_451.ProgramJobServer
PID: 15010
Folder Path: Temp/
Remote Instance: No
Creation Time: 12/1/2010 7:21 PM
Expiry: 12/1/2020 7:21 PM
Start Time: 12/1/2010 7:21 PM
End Time: 12/1/2010 7:21 PM
Error Message: No operating system credentials were set for running the program.
what might be the reasonwhat do u mean by pm application, i didn't get that
we r using boe xi 3.1 sp3.on sun solaris
my exact scenerio is
I wrote a shell script to delete the reports which r one month old. the reports generated by the boe r placed in unix machine(in a specific folder for example abc) and my boe server is also on unix .I imported the the shell script into boe.I assigned the path /xx/yy/abc (the path where our reports r stored) to the arguments and i gave the working directory path as the xx/yy/bobj/bobje/data/frsinput/a0_89/ ( this is the path where my shell script is present).after giving these details i am unable to delete any of the content from that folder. I am getting the failed message when i am trying to execute the object in cmc. i am pasting the shell script as well as the error message here if any body knows anything help me. do i need to set anything in cmc or what i need to do
this is the shell script to delete the files in the specified directory
#!/bin/ksh
# set -x
if [[ $# != 1 ]]; then
echo "Usage : $0 [Directory Path]"
exit 0
fi
echo "Source directory : " $1
# To display the list of files more than a month older
for v_fname in $(find "$1"/ -name "*" -mtime +30 -type f)
do
echo "$v_fname"
done
# To delete the files of more than 1 month older
find "$1"/ -name "*" -mtime +30 -type f -exec rm {} \; -
I recently installed firefox so I could use an adblocker. It installed just fine, and it worked just fine for about three days. Then yesterday it stopped opening. I'm on a Toshiba running Windows 7. The icon highlights when I click on it, but then it stops and won't open the browser at all. When I try to run it with the manual command "C:\Program Files\Mozilla Firefox\firefox.exe" -p, I get the error message, "C:\Program Files\Mozilla Firefox\ refers to a location that is unavailable. It could be on a hard drive on this computer, or on a network. Check to make sure that the disk is properly inserted, or that you are connected to the Internet or your network, and then try again. If it still cannot be located, the information might have been moved to a different location." I installed it to that location, and I don't need a disk. I'm connected to the Internet just fine and my other browsers (Chrome and IE) work the same as always. But they're swamped with ads and I really was happy wih Firefox when it was opening...how can I fix this issue?
Certain Firefox problems can be solved by performing a ''Clean reinstall''. This means you remove Firefox program files and then reinstall Firefox. Please follow these steps:
'''Note:''' You might want to print these steps or view them in another browser.
#Download the latest Desktop version of Firefox from http://www.mozilla.org and save the setup file to your computer.
#After the download finishes, close all Firefox windows (click Exit from the Firefox or File menu).
#Delete the Firefox installation folder, which is located in one of these locations, by default:
#*'''Windows:'''
#**C:\Program Files\Mozilla Firefox
#**C:\Program Files (x86)\Mozilla Firefox
#*'''Mac:''' Delete Firefox from the Applications folder.
#*'''Linux:''' If you installed Firefox with the distro-based package manager, you should use the same way to uninstall it - see [[Installing Firefox on Linux]]. If you downloaded and installed the binary package from the [http://www.mozilla.org/firefox#desktop Firefox download page], simply remove the folder ''firefox'' in your home directory.
#Now, go ahead and reinstall Firefox:
##Double-click the downloaded installation file and go through the steps of the installation wizard.
##Once the wizard is finished, choose to directly open Firefox after clicking the Finish button.
Please report back to see if this helped you! -
"Error determining planning periods for calendar " when running a program
Hi,
When i am running a program with date range say "01/05/2011" to "30/06/2011",the program is executing successfully without any error. When i am executing the same program with date range as a) "01/05/2009" to "30/06/2011" and b)"01/05/2008" to "30/06/2011" the program is failing with error as "Error determining planning periods for calendar". Can anyone suggest me what i should do to avoid the failure of the program with above date ranges also.
Thanks in advance,Dear,
Error message 61123:"Error determining planning periods for calendar &".The PPC planning calendar specified in the material master MRP 2 view for the material is incorrectly.
The planning calendar periods are insufficiently maintained for the planning calendar used.
Check the period of planning calendar in MD26 and generate the correct period.You can avoid the problem in several ways:
Maintain the planning calendar far enough in the future (at least until beyond the end of the planning horizon).
Also check any demand is lies beyond the validity period of planning calendar.
Reduction of the planning horizon of MRP also can control such issue, as MRP planning horizon lies in an area in which the planning calendar is no longer maintained
Regards,
R.Brahmankar -
Error whilst running a program
Hello all,
I am new to java and i ran into a probelm while trying to run ALL programs that has already compiled on the Windows command prompt.
The error i get is:
Exception in thread "main" java.lang.NoClassDefFoundError : Motorcycle:class
However, i have Eclipse IDE installed and when i run the same program there,it runs perfectly.
What could be wrong.Am using j2sdk 1.5.0.
NB
On the command prompt,compiling the program is not the problem but running it using:
java Motorcycle.class
ThanksWhen running a java program, you don't call the .class-File, you call the class itself and Java decides how it wants to find that class.
So instead of "java Motorcycle.class" you should use "java Motorcycle".
The command you used tries to exectue a class called "class" in the package "Motorcycle" which is obviously not what you want. -
Error in running the Program SDRQCR21
Hi,
For a material,the sales order which are rejected are showning in MD04.When i try to run this program
SDRQCR21,it gives me timed out error.
Since there are lot of sales order for that material.
Please can any one help me in this issue...
Thanks
SriniHi,
If we run the program,is the orders which are rejected gets deleted or any other scenario like delivery not created for the order etc will also get deleted from the MD04.
Please clarify on this issue.
Thanks
Srini -
Error while running the program of deferred Tax ( New)Program Name RFUMSV50
Hi
I am getting the error while running the program of deferred Tax ( New)
Following is the detailed error :
Enter rate / INR rate type M for 00.00.0000 in the system settings
Message no. SG105
Diagnosis
For the conversion of an amount into another currency, an entry is missing in the currency conversion table.
Procedure
Add the missing entry in the currency conversion table.
Execute function
You can then continue to process the commercial transaction.
Thanks & Regards,
PMCheck the following notes:-
1) Note 46582 - 2.2->3.0: error SG105 for exchange rate M w. inv.
2) Note 165645 - SG105:Enter rate & / & rate type & for 00.00.0000..
3) Note 483542 - F110: SG105 in maintenance of proposal run with wthhldng tax
4) Note 975657 - SG 105: FI-Enjoy with foreign currency and calculate tax
thanks
G. Lakshmipathi -
Getting an error when running my program but it compiles.
Hey guys, I'm having a problem running the program. Everything compiles correctly, but then I get the error code linked below. Everything I think is correct here. Any ideas? I posted CinReader as well in case you wanted to try compiling and running it yourself.
Thanks
public class TextShuffleLevel
private String jumble;
private String [] matchString;
public TextShuffleLevel ()
jumble = "dunops";
matchString = new String[5];
matchString[0] = new String("abound");
matchString[1] = new String("bound");
matchString[2] = new String("undo");
matchString[3] = new String("band");
matchString[4] = new String("bond");
public TextShuffleLevel (int whichDefaultLevel)
if (whichDefaultLevel == 1)
jumble = "dunops";
matchString = new String[5];
matchString[0] = new String("abound");
matchString[1] = new String("bound");
matchString[2] = new String("undo");
matchString[3] = new String("band");
matchString[4] = new String("bond");
else if (whichDefaultLevel == 2)
jumble = "srcaso";
matchString = new String[11];
matchString[0] = new String("across");
matchString[1] = new String("crass");
matchString[2] = new String("cross");
matchString[3] = new String("scars");
matchString[4] = new String("soars");
matchString[5] = new String("arcs");
matchString[6] = new String("soar");
matchString[7] = new String("scar");
matchString[8] = new String("oars");
matchString[9] = new String("cars");
matchString[10] = new String("orcs");
else
jumble = "eplcis";
matchString = new String[19];
matchString[0] = new String("splice");
matchString[1] = new String("spiel");
matchString[2] = new String("plies");
matchString[3] = new String("slice");
matchString[4] = new String("clips");
matchString[5] = new String("epics");
matchString[6] = new String("spice");
matchString[7] = new String("epic");
matchString[8] = new String("lice");
matchString[9] = new String("slip");
matchString[10] = new String("clip");
matchString[11] = new String("pile");
matchString[12] = new String("lisp");
matchString[13] = new String("pies");
matchString[14] = new String("isle");
matchString[15] = new String("lips");
matchString[16] = new String("lies");
matchString[17] = new String("ices");
matchString[18] = new String("pics");
public TextShuffleLevel (String newJumble, String [] newMatchString)
jumble = newJumble;
matchString = newMatchString;
/* This is the nasty one */
public boolean findMatch (String matchTry)
boolean foundMatch = false;
for (int i=0; i<matchString.length; i++)
if (matchTry.equalsIgnoreCase(matchString))
foundMatch = true;
break;
return foundMatch;
public void setJumble (String newJumble)
jumble = newJumble;
public void setMatchStrings (String [] newMatchString)
matchString = newMatchString;
public String getJumble ()
return jumble;
public int getJumbleLength ()
return jumble.length();
public int getNumberOfMatches ()
return matchString.length;
public String[] getMatchString ()
return matchString;
public class TextShuffleGame
private int playerLevel = 1; // start them on level 1
private CinReader reader;
private TextShuffleLevel l1;
private TextShuffleLevel l2;
private TextShuffleLevel l3;
private TextShuffleLevel onTheFly;
public TextShuffleGame ()
reader = new CinReader();
// Using Statically Set Levels
l1 = new TextShuffleLevel(1);
l2 = new TextShuffleLevel(2);
l3 = new TextShuffleLevel(3);
// this one allows for a 'custom' level
String fly[] = {"tea","at", "ate"};
onTheFly = new TextShuffleLevel("eta", fly);
//Setup for levels
public void go ()
boolean quit = false;
char choice = 'z';
int lastLevel = 0;
while (quit == false)
lastLevel = playerLevel;
if (playerLevel == 1)
play(l1);
else if (playerLevel == 2)
play(l2);
else if (playerLevel == 3)
play(l3);
else
play(onTheFly);
if (lastLevel == playerLevel)
System.out.print("Play the level again");
else
System.out.print("Play next level");
System.out.print("(y/n)? ");
choice = reader.readChar();
if (choice == 'N' || choice == 'n')
quit = true;
//Playing each level the same
public void play (TextShuffleLevel theLevel)
int numGuesses = 0;
int numCorrect = 0;
String userString = "";
System.out.println("What " + theLevel.getJumbleLength() + "-letter words can you get out of " +
theLevel.getJumble() + "?\n");
while (numGuesses < 5 && numCorrect < theLevel.getNumberOfMatches())
System.out.print("Enter a string: ");
userString = reader.readString();
if (theLevel.findMatch(userString) == true)
System.out.println("Great! A match!");
numCorrect = numCorrect + 1;
else
System.out.println("Drat... not a match");
numGuesses = numGuesses + 1;
if (numCorrect == theLevel.getNumberOfMatches())
System.out.println("Terrific! You are ready to try a harder jumble");
playerLevel = playerLevel + 1;
/* FOR TESTING ONLY -- TO BE REMOVED FOR RELEASE */
public static void main (String [] args)
TextShuffleGame tsg = new TextShuffleGame();
tsg.go();
import java.io.*;
import java.util.*;
public class CinReader
private static final int INT_MESSAGE = 0;
private static final int DOUBLE_MESSAGE = 1;
private static final int CHAR_MESSAGE = 2;
private static final int STRING_MESSAGE = 3;
private static final int BOOLEAN_MESSAGE = 4;
private static final String DEFAULT_ERROR_MESSAGE = "Please reenter. ";
private String prompt = "> ";
private String [] errorMessages;
public CinReader ()
prompt = "> ";
setDefaultMessages();
public CinReader (String newPrompt)
prompt = newPrompt;
setDefaultMessages();
public CinReader (String newPrompt, String [] newErrorMessages)
prompt = newPrompt;
if (newErrorMessages != null)
setErrorMessages(newErrorMessages);
else
setDefaultMessages();
public void setPrompt (String newPrompt)
prompt = newPrompt;
public void setErrorMessages (String [] newErrorMessages)
if (newErrorMessages != null)
int diff = errorMessages.length - newErrorMessages.length;
// NEED A MINIMUM OF 5 ERROR MESSAGES TO AVOID ERRORS
if (diff > 0)
errorMessages = new String[5];
for (int i=0; i<5; i++)
if (i < newErrorMessages.length)
errorMessages[i] = new String(newErrorMessages);
else
errorMessages[i] = new String(DEFAULT_ERROR_MESSAGE);
else
errorMessages = newErrorMessages;
public void setErrorMessage (int idx, String msg)
if (idx >= 0 && idx < errorMessages.length)
errorMessages[idx] = msg;
public void setErrorMessageString (String msg)
errorMessages[STRING_MESSAGE] = msg;
public void setErrorMessageInt (String msg)
errorMessages[INT_MESSAGE] = msg;
public void setErrorMessageDouble (String msg)
errorMessages[DOUBLE_MESSAGE] = msg;
public void setErrorMessageChar (String msg)
errorMessages[CHAR_MESSAGE] = msg;
public void setErrorMessageBoolean (String msg)
errorMessages[BOOLEAN_MESSAGE] = msg;
public String readString()
char theChar = 'x';
String result = "";
boolean done = false;
while (!done)
theChar = nextChar();
if (theChar == '\n')
done = true;
else if (theChar == '\r'){}
else
result = result + theChar;
return result;
public String readString (boolean allowEmpty)
String result = readString();
if (!allowEmpty)
while (result.length() == 0)
System.out.println("Empty input not allowed. " + errorMessages[STRING_MESSAGE]);
System.out.print(prompt);
result = readString();
return result;
public String readString (int charLimit)
String result = readString();
if (result.length() > charLimit)
result = result.substring(0, charLimit);
return result;
public String readString (boolean allowEmpty, int charLimit)
String result = readString(allowEmpty);
if (result.length() > charLimit)
result = result.substring(0, charLimit);
return result;
public int readInt()
String inputString = "";
int number = 0;
boolean done = false;
while (!done)
try
inputString = readString();
inputString = inputString.trim();
number = (Integer.valueOf(inputString).intValue());
done = true;
catch (NumberFormatException e)
System.out.println("Input is not an integer. " + errorMessages[INT_MESSAGE]);
System.out.print(prompt);
return number;
public int readInt(int min, int max)
String inputString = "";
int number = 0;
boolean done = false;
while (!done)
try
inputString = readString();
inputString = inputString.trim();
number = (Integer.valueOf(inputString).intValue());
if (number < min || number > max)
System.out.println("Please enter an integer between " + min + " and " + max);
else
done = true;
catch (NumberFormatException e)
System.out.println("Input is not an integer. " + errorMessages[INT_MESSAGE]);
System.out.print(prompt);
return number;
public double readDouble()
String inputString = "";
double number = 0;
boolean done = false;
while (!done)
try
inputString = readString();
inputString = inputString.trim();
number = (Double.valueOf(inputString).doubleValue());
done = true;
catch (NumberFormatException e)
System.out.println("Input is not an integer. " + errorMessages[DOUBLE_MESSAGE]);
System.out.print(prompt);
return number;
public char readChar()
boolean done = false;
String inputString = "";
char nonWhite = 'x';
while (!done)
inputString = readString();
inputString = inputString.trim();
if (inputString.length() != 1)
System.out.println("Input must be a single character. " + errorMessages[CHAR_MESSAGE]);
System.out.print(prompt);
else
nonWhite = (inputString.charAt(0));
done = true;
return nonWhite;
public char readChar (String range)
char theChar = 'x';
boolean done = false;
while (!done)
theChar = readChar();
for (int i=0; i<range.length(); i++)
if (theChar == range.charAt(i))
done = true;
break;
if (!done)
System.out.print("Invalid input. Please enter one of the following -> ");
for (int i=0; i<range.length(); i++)
System.out.print(range.charAt(i) + " ");
System.out.print("\n" + prompt);
return theChar;
public boolean readBoolean()
boolean done = false;
String inputString = "";
boolean result = false;
while (!done)
inputString = readString(false);
inputString = inputString.trim();
if (inputString.equalsIgnoreCase("true") || inputString.equalsIgnoreCase("t"))
result = true;
done = true;
else if (inputString.equalsIgnoreCase("false") || inputString.equalsIgnoreCase("f"))
result = false;
done = true;
else
System.out.println("Input must be [t]rue or [f]alse. " + errorMessages[BOOLEAN_MESSAGE]);
System.out.print(prompt);
return result;
private void setDefaultMessages ()
errorMessages = new String[5];
for (int i=0; i<errorMessages.length; i++)
errorMessages[i] = new String(DEFAULT_ERROR_MESSAGE);
private char nextChar()
int charAsInt = -1;
try
charAsInt = System.in.read();
catch(IOException e)
System.out.println(e.getMessage());
System.out.println("Fatal error. Exiting program.");
System.exit(0);
return (char)charAsInt;Ok, here's what I did using the JSE 8.1 IDE.
1) I copied your code into a .java file named "TextShuffleGame".
It generated about half a dozon errors.
There are three classes in the program:
TextShuffleLevel
TextShuffleGame
CinReader
Each of these classes is declared "public" and I got the same error message on each one:
"class ... is public, should be declared in a file name ... .java"
so, I...
2) tried changing them to "private".
It then said: "modifier private not allowed here".
so, I...
3) deleted the modifiers for these three classes and left them as just class. No errors.
The next two errors had to do with the two import statements:
"import java.io.*;" and "import java.util.*;".
It said: "'class' or 'identifier' expected" for both. So, I...
4) moved them to the top of the source file.
Didn't help at first. So, I...
5) fiddle around with them a bit.
I tried "java.io;" and "java.util;" and then "java.*;" by itself. Still got errors. So, I put them back as you had them and for some mysterious reason, my editor decided they were fine. oO
This also corrected the last errors in the "CinReader" class. Here is the error-free code I now have in my "TextShuffleGame.java" file:
import java.io.*;
import java.util.*;
class TextShuffleLevel
private String jumble;
private String [] matchString;
public TextShuffleLevel ()
jumble = "dunops";
matchString = new String[5];
matchString[0] = new String("abound");
matchString[1] = new String("bound");
matchString[2] = new String("undo");
matchString[3] = new String("band");
matchString[4] = new String("bond");
public TextShuffleLevel (int whichDefaultLevel)
if (whichDefaultLevel == 1)
jumble = "dunops";
matchString = new String[5];
matchString[0] = new String("abound");
matchString[1] = new String("bound");
matchString[2] = new String("undo");
matchString[3] = new String("band");
matchString[4] = new String("bond");
else if (whichDefaultLevel == 2)
jumble = "srcaso";
matchString = new String[11];
matchString[0] = new String("across");
matchString[1] = new String("crass");
matchString[2] = new String("cross");
matchString[3] = new String("scars");
matchString[4] = new String("soars");
matchString[5] = new String("arcs");
matchString[6] = new String("soar");
matchString[7] = new String("scar");
matchString[8] = new String("oars");
matchString[9] = new String("cars");
matchString[10] = new String("orcs");
else
jumble = "eplcis";
matchString = new String[19];
matchString[0] = new String("splice");
matchString[1] = new String("spiel");
matchString[2] = new String("plies");
matchString[3] = new String("slice");
matchString[4] = new String("clips");
matchString[5] = new String("epics");
matchString[6] = new String("spice");
matchString[7] = new String("epic");
matchString[8] = new String("lice");
matchString[9] = new String("slip");
matchString[10] = new String("clip");
matchString[11] = new String("pile");
matchString[12] = new String("lisp");
matchString[13] = new String("pies");
matchString[14] = new String("isle");
matchString[15] = new String("lips");
matchString[16] = new String("lies");
matchString[17] = new String("ices");
matchString[18] = new String("pics");
public TextShuffleLevel (String newJumble, String [] newMatchString)
jumble = newJumble;
matchString = newMatchString;
/* This is the nasty one */
public boolean findMatch (String matchTry)
boolean foundMatch = false;
for (int i=0; i<matchString.length; i++)
if (matchTry.equalsIgnoreCase(matchString))
foundMatch = true;
break;
return foundMatch;
public void setJumble (String newJumble)
jumble = newJumble;
public void setMatchStrings (String [] newMatchString)
matchString = newMatchString;
public String getJumble ()
return jumble;
public int getJumbleLength ()
return jumble.length();
public int getNumberOfMatches ()
return matchString.length;
public String[] getMatchString ()
return matchString;
class TextShuffleGame
private int playerLevel = 1; // start them on level 1
private CinReader reader;
private TextShuffleLevel l1;
private TextShuffleLevel l2;
private TextShuffleLevel l3;
private TextShuffleLevel onTheFly;
public TextShuffleGame ()
reader = new CinReader();
// Using Statically Set Levels
l1 = new TextShuffleLevel(1);
l2 = new TextShuffleLevel(2);
l3 = new TextShuffleLevel(3);
// this one allows for a 'custom' level
String fly[] = {"tea","at", "ate"};
onTheFly = new TextShuffleLevel("eta", fly);
//Setup for levels
public void go ()
boolean quit = false;
char choice = 'z';
int lastLevel = 0;
while (quit == false)
lastLevel = playerLevel;
if (playerLevel == 1)
play(l1);
else if (playerLevel == 2)
play(l2);
else if (playerLevel == 3)
play(l3);
else
play(onTheFly);
if (lastLevel == playerLevel)
System.out.print("Play the level again");
else
System.out.print("Play next level");
System.out.print("(y/n)? ");
choice = reader.readChar();
if (choice == 'N' || choice == 'n')
quit = true;
//Playing each level the same
public void play (TextShuffleLevel theLevel)
int numGuesses = 0;
int numCorrect = 0;
String userString = "";
System.out.println("What " + theLevel.getJumbleLength() + "-letter words can you get out of " +
theLevel.getJumble() + "?\n");
while (numGuesses < 5 && numCorrect < theLevel.getNumberOfMatches())
System.out.print("Enter a string: ");
userString = reader.readString();
if (theLevel.findMatch(userString) == true)
System.out.println("Great! A match!");
numCorrect = numCorrect + 1;
else
System.out.println("Drat... not a match");
numGuesses = numGuesses + 1;
if (numCorrect == theLevel.getNumberOfMatches())
System.out.println("Terrific! You are ready to try a harder jumble");
playerLevel = playerLevel + 1;
/* FOR TESTING ONLY -- TO BE REMOVED FOR RELEASE */
public static void main (String [] args)
TextShuffleGame tsg = new TextShuffleGame();
tsg.go();
class CinReader
private static final int INT_MESSAGE = 0;
private static final int DOUBLE_MESSAGE = 1;
private static final int CHAR_MESSAGE = 2;
private static final int STRING_MESSAGE = 3;
private static final int BOOLEAN_MESSAGE = 4;
private static final String DEFAULT_ERROR_MESSAGE = "Please reenter. ";
private String prompt = "> ";
private String [] errorMessages;
public CinReader ()
prompt = "> ";
setDefaultMessages();
public CinReader (String newPrompt)
prompt = newPrompt;
setDefaultMessages();
public CinReader (String newPrompt, String [] newErrorMessages)
prompt = newPrompt;
if (newErrorMessages != null)
setErrorMessages(newErrorMessages);
else
setDefaultMessages();
public void setPrompt (String newPrompt)
prompt = newPrompt;
public void setErrorMessages (String [] newErrorMessages)
if (newErrorMessages != null)
int diff = errorMessages.length - newErrorMessages.length;
// NEED A MINIMUM OF 5 ERROR MESSAGES TO AVOID ERRORS
if (diff > 0)
errorMessages = new String[5];
for (int i=0; i<5; i++)
if (i < newErrorMessages.length)
errorMessages[i] = new String(newErrorMessages[i]);
else
errorMessages[i] = new String(DEFAULT_ERROR_MESSAGE);
else
errorMessages = newErrorMessages;
public void setErrorMessage (int idx, String msg)
if (idx >= 0 && idx < errorMessages.length)
errorMessages[idx] = msg;
public void setErrorMessageString (String msg)
errorMessages[STRING_MESSAGE] = msg;
public void setErrorMessageInt (String msg)
errorMessages[INT_MESSAGE] = msg;
public void setErrorMessageDouble (String msg)
errorMessages[DOUBLE_MESSAGE] = msg;
public void setErrorMessageChar (String msg)
errorMessages[CHAR_MESSAGE] = msg;
public void setErrorMessageBoolean (String msg)
errorMessages[BOOLEAN_MESSAGE] = msg;
public String readString()
char theChar = 'x';
String result = "";
boolean done = false;
while (!done)
theChar = nextChar();
if (theChar == '\n')
done = true;
else if (theChar == '\r'){}
else
result = result + theChar;
return result;
public String readString (boolean allowEmpty)
String result = readString();
if (!allowEmpty)
while (result.length() == 0)
System.out.println("Empty input not allowed. " + errorMessages[STRING_MESSAGE]);
System.out.print(prompt);
result = readString();
return result;
public String readString (int charLimit)
String result = readString();
if (result.length() > charLimit)
result = result.substring(0, charLimit);
return result;
public String readString (boolean allowEmpty, int charLimit)
String result = readString(allowEmpty);
if (result.length() > charLimit)
result = result.substring(0, charLimit);
return result;
public int readInt()
String inputString = "";
int number = 0;
boolean done = false;
while (!done)
try
inputString = readString();
inputString = inputString.trim();
number = (Integer.valueOf(inputString).intValue());
done = true;
catch (NumberFormatException e)
System.out.println("Input is not an integer. " + errorMessages[INT_MESSAGE]);
System.out.print(prompt);
return number;
public int readInt(int min, int max)
String inputString = "";
int number = 0;
boolean done = false;
while (!done)
try
inputString = readString();
inputString = inputString.trim();
number = (Integer.valueOf(inputString).intValue());
if (number < min || number > max)
System.out.println("Please enter an integer between " + min + " and " + max);
else
done = true;
catch (NumberFormatException e)
System.out.println("Input is not an integer. " + errorMessages[INT_MESSAGE]);
System.out.print(prompt);
return number;
public double readDouble()
String inputString = "";
double number = 0;
boolean done = false;
while (!done)
try
inputString = readString();
inputString = inputString.trim();
number = (Double.valueOf(inputString).doubleValue());
done = true;
catch (NumberFormatException e)
System.out.println("Input is not an integer. " + errorMessages[DOUBLE_MESSAGE]);
System.out.print(prompt);
return number;
public char readChar()
boolean done = false;
String inputString = "";
char nonWhite = 'x';
while (!done)
inputString = readString();
inputString = inputString.trim();
if (inputString.length() != 1)
System.out.println("Input must be a single character. " + errorMessages[CHAR_MESSAGE]);
System.out.print(prompt);
else
nonWhite = (inputString.charAt(0));
done = true;
return nonWhite;
public char readChar (String range)
char theChar = 'x';
boolean done = false;
while (!done)
theChar = readChar();
for (int i=0; i<range.length(); i++)
if (theChar == range.charAt(i))
done = true;
break;
if (!done)
System.out.print("Invalid input. Please enter one of the following -> ");
for (int i=0; i<range.length(); i++)
System.out.print(range.charAt(i) + " ");
System.out.print("\n" + prompt);
return theChar;
public boolean readBoolean()
boolean done = false;
String inputString = "";
boolean result = false;
while (!done)
inputString = readString(false);
inputString = inputString.trim();
if (inputString.equalsIgnoreCase("true") || inputString.equalsIgnoreCase("t"))
result = true;
done = true;
else if (inputString.equalsIgnoreCase("false") || inputString.equalsIgnoreCase("f"))
result = false;
done = true;
else
System.out.println("Input must be [t]rue or [f]alse. " + errorMessages[BOOLEAN_MESSAGE]);
System.out.print(prompt);
return result;
private void setDefaultMessages ()
errorMessages = new String[5];
for (int i=0; i < errorMessages.length; i++)
errorMessages[i] = new String(DEFAULT_ERROR_MESSAGE);
private char nextChar()
int charAsInt = -1;
try
charAsInt = System.in.read();
catch(IOException e)
System.out.println(e.getMessage());
System.out.println("Fatal error. Exiting program.");
System.exit(0);
return (char)charAsInt;
Hope that helps. -
Error while running the program
Hello everybody
I have installed jdk in my computer, but when I try to run the program it shows the following error
"Unable to load the main class"
The program is compiling properly the only problem is in running the program.
What is the reason for this error and how can I fix this error?
RegardsAre you familiar with the classpath?
It tells the JRE which directory has your *.class files.
At the command line, you would java -cp dir_name class_file_nameIf you're using an IDE, check the menus at the top of the editor screen.
Maybe you are looking for
-
How do I use Time Capsule as a wireless router and turn my current one into modem only
I have a crappy modem/ router and before I purchase a new modem I want to use the modem (no wireless) feature of my router. Question #1 How do I use my Time Capsule as a router? Question #2 If I do this will I still be able to wirelessly back up to m
-
Windows 7 64-bit drivers for HP ScanJet 6200c
Hello HP, Will you be releasing 64-bit drivers for the ScanJet 6200c? Regards, Dean.
-
How to create views in OBIEE?
Hi everyone, I'm new to OBIEE. My requirement is i need to apply different filters to each columns in a report. But if i apply any filter it is applying to all the columns. For example, My report column is something like StudentsPassed || StudentsFai
-
Pixel Aspect & Compressor for PAL going to NTSC
hi. I have PAL clips which be part of an NTSC iDVD project. do I need to export the QT movies in NTSC format? i.e., do I need to change the sequence compressor and pixel aspects to NTSC? do I need to change the PAL clips within the NTSC timelines to
-
Error: photoshop.com services are currently unavailable. please try again later or check your network connection. error 400. What can I do to resolve this problem but I noticed it allowed me to sign in under this site.