Installed JDK 6 but OperatorsChar.d doesn't work

Having trouble getting started? Check here...
Post Reply
HughDarwen
Posts: 124
Joined: Sat May 24, 2008 4:49 pm

Installed JDK 6 but OperatorsChar.d doesn't work

Post by HughDarwen »

I'm running Rel 0.3.5 Alpha on Windows Vista.

I installed the latest version of JDK but loading and executing OperatorsChar.d always gives the following:

ERROR: ca.mb.armchair.rel3.exceptions.ExceptionSemantic: java.io.IOException: Cannot run program "javac": CreateProcess error=2, The system cannot find the file specified
Line 3
In SUBSTRING(CHARACTER, INTEGER) RETURNS CHARACTER line 1

javac.exe exists in C:\Program Files\Java\jdk1.6.0_06\bin. I tried adding this location to my system's path environment variable but that didn't help.

Hugh Darwen
Dave
Site Admin
Posts: 372
Joined: Sun Nov 27, 2005 7:19 pm

Re: Installed JDK 6 but OperatorsChar.d doesn't work

Post by Dave »

Hi Hugh,

Could you start up the Windows command prompt (Start | Accessories | Command Prompt) and type...

javac -version

...at the prompt?

This will help me to determine whether the problem lies with Rel invoking the javac compiler, or with Vista finding the javac compiler. If the above runs the javac compiler, then the problem is in Rel and I'll fix it. If the above can't find the javac compiler, then there's an issue with the Windows path. Unfortunately, at the moment I don't have a Vista machine close to hand so I can't test this myself, but I'll try to round one up.
HughDarwen
Posts: 124
Joined: Sat May 24, 2008 4:49 pm

Re: Installed JDK 6 but OperatorsChar.d doesn't work

Post by HughDarwen »

Hmm. It seems to be something wrong with my system path. When I start up cmd.exe I get this

The system cannot find message text for message number 0x2350 in the message fil
e for Application.

The system cannot find message text for message number 0x2334 in the message fil
e for Application.

Then, the same happens when I try to execute javac:

C:\hp\bin>javac -version
The system cannot find message text for message number 0x2331 in the message fil
e for Application.

Curiously, the system seems to find java okay:

C:\>java -version
java version "1.6.0_06"
Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
Java HotSpot(TM) Client VM (build 10.0-b22, mixed mode, sharing)

Hugh
HughDarwen
Posts: 124
Joined: Sat May 24, 2008 4:49 pm

Re: Installed JDK 6 but OperatorsChar.d doesn't work

Post by HughDarwen »

Yes, my system path had some nonexistent directories in it. I fixed that and now javac -version works. But now other things have gone wrong, so I'll get back to you when I've investigated further.

Hugh
HughDarwen
Posts: 124
Joined: Sat May 24, 2008 4:49 pm

Re: Installed JDK 6 but OperatorsChar.d doesn't work

Post by HughDarwen »

Okay, now OperatorsChar.d works, but invocation of the defined operators doesn't. They all give the same exception, "String index out of range: 1." Here's an example:

EQUALS_IGNORE_CASE('Darwen','DARWEN')
ERROR: java.lang.StringIndexOutOfBoundsException: String index out of range: 1
java.lang.StringIndexOutOfBoundsException: String index out of range: 1
at java.lang.String.charAt(Unknown Source)
at java.util.regex.Matcher.appendReplacement(Unknown Source)
at java.util.regex.Matcher.replaceAll(Unknown Source)
at java.lang.String.replaceAll(Unknown Source)
at ca.mb.armchair.rel3.external.DirClassLoader$1.getClassFileName(DirClassLoader.java:57)
at ca.mb.armchair.rel3.external.DirClassLoader$1.loadClassData(DirClassLoader.java:66)
at ca.mb.armchair.rel3.external.DirClassLoader$1.findClass(DirClassLoader.java:40)
at ca.mb.armchair.rel3.external.DirClassLoader$1.loadClass(DirClassLoader.java:50)
at java.lang.ClassLoader.loadClass(Unknown Source)
at ca.mb.armchair.rel3.external.DirClassLoader.forName(DirClassLoader.java:86)
at ca.mb.armchair.rel3.storage.RelDatabase.loadClass(RelDatabase.java:711)
at ca.mb.armchair.rel3.storage.RelDatabase.getMethod(RelDatabase.java:721)
at ca.mb.armchair.rel3.storage.RelDatabase.loadOperator(RelDatabase.java:748)
at ca.mb.armchair.rel3.generator.Generator.findOperator(Generator.java:314)
at ca.mb.armchair.rel3.generator.Generator.compileEvaluate(Generator.java:1526)
at ca.mb.armchair.rel3.interpreter.TutorialDParser.visit(TutorialDParser.java:1412)
at ca.mb.armchair.rel3.languages.tutoriald.parser.ASTFnInvoke.jjtAccept(ASTFnInvoke.java:17)
at ca.mb.armchair.rel3.interpreter.TutorialDParser.compileChild(TutorialDParser.java:60)
at ca.mb.armchair.rel3.interpreter.TutorialDParser.visit(TutorialDParser.java:219)
at ca.mb.armchair.rel3.languages.tutoriald.parser.ASTExpression.jjtAccept(ASTExpression.java:17)
at ca.mb.armchair.rel3.interpreter.TutorialDParser.compileChild(TutorialDParser.java:60)
at ca.mb.armchair.rel3.interpreter.TutorialDParser.visit(TutorialDParser.java:128)
at ca.mb.armchair.rel3.languages.tutoriald.parser.ASTEvaluate.jjtAccept(ASTEvaluate.java:17)
at ca.mb.armchair.rel3.interpreter.Interpreter.evaluate(Interpreter.java:135)
at ca.mb.armchair.rel3.interpreter.Interpreter.evaluate(Interpreter.java:235)
at ca.mb.armchair.rel3.interpreter.Interpreter.evaluate(Interpreter.java:239)
at ca.mb.armchair.rel3.client.stream.ClientLocalConnection.sendEvaluate(ClientLocalConnection.java:34)
at ca.mb.armchair.rel3.client.string.ClientLocal.sendEvaluate(ClientLocal.java:52)
at ca.mb.armchair.rel3.dbrowser.PanelCommandline.doRun(PanelCommandline.java:780)
at ca.mb.armchair.rel3.dbrowser.PanelCommandline.access$23(PanelCommandline.java:766)
at ca.mb.armchair.rel3.dbrowser.PanelCommandline$18.actionPerformed(PanelCommandline.java:559)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Am I too much of a novice at Java to be doing this?

Hugh
Dave
Site Admin
Posts: 372
Joined: Sun Nov 27, 2005 7:19 pm

Re: Installed JDK 6 but OperatorsChar.d doesn't work

Post by Dave »

HughDarwen wrote:Am I too much of a novice at Java to be doing this?
No. In fact, the whole purpose of this facility is to easily extend Rel primitives without having to know any Java! :roll:

This is a peculiar bug, because the log you've provided indicates it's occurring inside the Java library's java.lang.String.replaceAll method. It's occurring when Rel attempts to load the compiled Java class file that implements the operator; it hasn't even reached the point of executing the operator. In the given context, it should be doing nothing more stressful than changing a string like "Database.RelUserCode.Date" to "Database\RelUserCode\Date", in order to obtain the file path to the compiled Java class. I've been trying to duplicate this bug most of yesterday evening and this morning without success. Every test I run works.

I am, however, suspicious of something you mentioned in a previous message. You mentioned that you could successfully run java from the command line, but not javac. This makes me wonder if you have more than one Java installation on your machine -- probably one is a Java Runtime Edition (JRE) version and the other is a JDK version, because being able to run java but not javac usually means you're accessing a JRE but not a JDK. However, you must have a working JDK, because OperatorsChar.d is now being successfully compiled. This makes me suspect that the problem might be caused by Rel effectively running on two slightly different Java systems -- perhaps with slightly incompatible libraries. We had this happen on the university lab machines once -- a JRE version of Java that was part of an Oracle installation interfered with a JDK installation, with similar peculiar results.

So... Could you check to see if you have more than one Java installation? Searching for all instances of java.exe on the machine should indicate if this is the case.

However, if it turns out you have only one Java installation, I'll provide you with an updated Rel.jar file which will contain some debugging code. It will generate some additional log messages that I'll get you to send me, which will hopefully pinpoint the cause of the problem.
Dave
Site Admin
Posts: 372
Joined: Sun Nov 27, 2005 7:19 pm

Re: Installed JDK 6 but OperatorsChar.d doesn't work

Post by Dave »

I've just released version 0.3.6 Alpha, which contains a small change in the way Java-based operators are loaded. I'm hoping this will fix the problem.
HughDarwen
Posts: 124
Joined: Sat May 24, 2008 4:49 pm

Re: Installed JDK 6 but OperatorsChar.d doesn't work

Post by HughDarwen »

Yes, I found I had several copies of Java on my computer. In fact, in c:\Program files\Java I found 7 or 8 directories for various different versions of JRE and JDK. It seems, then, that every time I've accepted the invitation to upgrade Java the previous version has been left intact.

Also, my installation of Sybase's SQL Anywhere, required in connection with some of my university work, includes a java.exe too, and some SQL Anywhere directories are included in my system path. And btw, although Windows Vista's awful new search facility finds this copy, it doesn't find any of the ones in c:\Program files\Java, even when I ask for hidden and system files to be included in the search.

I don't think I'm going to be able to reduce my copies of java.exe to just one, but in any case I am pleased to report that the new Rel version 0.3.6 has fixed the problem and SUBSTRING etc. now do work for me. Many thanks!

Hugh
Dave
Site Admin
Posts: 372
Joined: Sun Nov 27, 2005 7:19 pm

Re: Installed JDK 6 but OperatorsChar.d doesn't work

Post by Dave »

A possible explanation for this problem: It seems when a Windows system advises that a new Java update is available, the update may install a new JRE even if a JDK installation is being used. So, it's entirely possible to wind up using the latest Java run-time with an older javac Java compiler. I don't know if this is a universal problem; it seems to occur if you install a JRE before installing a JDK. If you install a JDK first, maybe it continues updating JDKs. I'll look into this further.
Post Reply