• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Copile time error

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have to make some change in an application which don't have the code base. So i have tried to decompile the class files into java class with the help of some decompiler.
In one of the java class i found the following code which is going me compiler error.

Class aclass[] = {
com/sun/java/util/collections/HashMap
};

Please note, at the beginning of the java class, i have import com.sun.java.util.collections.HashMap;

Can you point me what is the wrong with the code.

Thanks In advance.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note that this an array of Class objects, so something like

Class.forName("com.sun.java.util.collections.HashMap")

may do the trick.
 
Marshal
Posts: 79178
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you really want the com.sun version rather than the java.util.HashMap class?
 
PRITAM KUNDU
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
actually i need com.sun version because that is used by the application itself....
If i try,

Class aclass[]={ new com.sun.java.util.collection.HashMap().getClass()};

Will it make wrong implementation ??
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am sorry to disturb, but whenever you encounter a Compilation Error or a RuntimeException, the question really belongs in the Java beginners forum.
 
Campbell Ritchie
Marshal
Posts: 79178
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That depends what the exact error is, particularly with an Exception, whether it is really a beginner's topic.

But we don't know what the error is yet. We need more details.
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

PRITAM KUNDU wrote:Class aclass[]={ new com.sun.java.util.collection.HashMap().getClass()};


The following will be a little bit more efficient because it doesn't create a new HashMap object:


 
reply
    Bookmark Topic Watch Topic
  • New Topic