Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 822
  • Last Modified:

How to use the JavaEditorKit under Java 1.4.2_05

Hi,

I am currently running Java 1.4.2_05-b04. I am having trouble running the JavaEditorKit provided by Sun at

http://java.sun.com/products/jfc/tsc/articles/text/editor_kit/

I am getting quite a lot of errors while trying to compile it. Does anyone if there is anything that I can do to get it working?


Thanks!!
0
_MW_
Asked:
_MW_
  • 10
  • 8
  • 6
2 Solutions
 
objectsCommented:
what errors are you getting?
0
 
_MW_Author Commented:
Um...there is just too many errors....Do you want me to post all the errors?
0
 
objectsCommented:
post the first few and we can start on them :)
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
_MW_Author Commented:
Is it possible for you to try to compile the files provided and have a look at the errors? When you see those errors you would know why I am not posting them here...I think it has something to do with some incompatibility issues as it is an old editor kit. But it seems that these issues may have have been fixed.
0
 
_MW_Author Commented:
0
 
objectsCommented:
Its already compiled, why do you need to compile it?
0
 
sudhakar_koundinyaCommented:
place all files in one directory and compile them like this

javac -d . *.java

It solves ur problem
0
 
_MW_Author Commented:
Hmm...i tried it and it did not work...i get too many compile errors until I ran out of memory..

0
 
objectsCommented:
I don't think sun.tools.java package exists anymore, so you'll probably need to change the code to not use it.
Or use an earlier version of the jdk.
0
 
_MW_Author Commented:
that's what I thought as well...that's why I was wondering if there was any other way other than using the old jdk versions...This is because the kit provided is ideal for the program I am working on and I would really like to use it and I am hoping that there is a way to use it for the current versions of the jdk...I also found out that one of the classes which is missing is known as Scanner which is available in jdk 1.5...
0
 
sudhakar_koundinyaCommented:
do one thing

import com.sun.java.swing.*;
import com.sun.java.swing.text.*;

replace these two lines

like this
import javax.swing.*;
import javax.swing.text.*;

in all files and javac -d . *.java
0
 
_MW_Author Commented:
I have tried that before....it doesn't work..
0
 
objectsCommented:
> This is because the kit provided is ideal for the program I am working on

What is it you need?

> would really like to use it and I am hoping that there is a way to use it for the current versions of the jdk

No need to either find the required classes, or change the code to not use them.

> I also found out that one of the classes which is missing is known as Scanner which is available in jdk 1.5...

May not actually be the same class
0
 
_MW_Author Commented:
> This is because the kit provided is ideal for the program I am working on

>What is it you need?

I need a kit that can help me show Java syntax when viewing a source code. So it will be able to do highlighting of Java keywords such as public, int, etc..

> would really like to use it and I am hoping that there is a way to use it for the current versions of the jdk

> No need to either find the required classes, or change the code to not use them.

Don't know where to find the classes =( That's why I am bringing up this problem and hoping that someone had actually been through the same problem as I did and manage to solve it since the JavaEditorKit is a really good plug in provided.

I am not good enough to go in and change the code =(

0
 
sudhakar_koundinyaCommented:
In Token.java

try to implement the constants like this

public static final int COMMA = 0;
public static final int ASSIGN =1;
public static final int ASGMUL =2;
public static final int ASGDIV =3;
public static final int ASGREM= 4;
public static final int ASGADD=5 ;
public static final int ASGSUB=6;
public static final int ASGLSHIFT=7;

public static final int ASGRSHIFT=8;
public static final int ASGURSHIFT=9;
public static final int ASGBITAND=10;
public static final int ASGBITOR=11;
public static final int ASGBITXOR=12;
public static final int COND=13;
public static final int OR=14;
public static final int AND=15;

and so on

and remove import sun.tools.java.Constants; from that file
0
 
objectsCommented:
try downloading old jdk version and see if it has the required package.
0
 
objectsCommented:
Ignore my previous comments about the package not being available in the latest JDK, i missed it when i looked earlier.

you'll find it in <jdk>/lib/tools.jar

just add that to your classpath
0
 
sudhakar_koundinyaCommented:
Just found the API at <JAva>\lib\tool.jar.

You can use that
0
 
sudhakar_koundinyaCommented:
You have already identified that. Didn't refresh
0
 
_MW_Author Commented:
I added it to the classpath but I am still getting errors such as ..

examples\javakit\GapContent.java:52: package AbstractDocument does not exist
public final class GapContent implements AbstractDocument.Content, Serializable
{
                                                         ^
examples\javakit\GapContent.java:97: cannot resolve symbol
symbol  : class BadLocationException
location: class examples.javakit.GapContent
    public UndoableEdit insertString(int where, String str) throws BadLocationEx
ception {
                                                                   ^
examples\javakit\GapContent.java:115: cannot resolve symbol
symbol  : class BadLocationException
location: class examples.javakit.GapContent
    public UndoableEdit remove(int where, int nitems) throws BadLocationExceptio
n {
                                                             ^
examples\javakit\GapContent.java:133: cannot resolve symbol
symbol  : class BadLocationException
location: class examples.javakit.GapContent
    public String getString(int where, int len) throws BadLocationException {
0
 
sudhakar_koundinyaCommented:
import javax.swing.text.*;
import javax.swing.*;

as suggested earlier and re compile them again
0
 
_MW_Author Commented:
It worked!!

Thanks a lot guys for the time and effort spent...
0
 
objectsCommented:
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 10
  • 8
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now