Results 1 to 4 of 4
  1. #1
    gwaldarick is offline Member
    Join Date
    Dec 2008
    Posts
    3
    Rep Power
    0

    Default Running extensions other than .class

    Hi everyone,
    I am trying to make a program which will treat any file with any extension as a .class file.
    My main reason for this is that I simply want to have files ending differently and not have the generic "class" attachment.
    I have a main class which can always create a new .class file as long as that .class file is in the same directory, but how can I make it treat other files the same way?

    thanks.

  2. #2
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    953
    Rep Power
    5

    Default

    You want to have Java class files, but without the .class extension? Why? I don't know of any way to do this, other than hacking your JRE, and I don't know why you'd want to.

    -Gary-

  3. #3
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    Quote Originally Posted by gwaldarick View Post
    Hi everyone,
    ...
    My main reason for this is that I simply want to have files ending differently and not have the generic "class" attachment.
    ...
    Do you think you can explain this using different words perhaps.
    My mortal mind is failing to grasp what you are trying to do and why.

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,003
    Blog Entries
    7
    Rep Power
    20

    Default

    You have to build your own ClassLoader; see the API documentation for that class for an example how to load the data from any file and turn it into a class (all your loader has to do is create a byte[] that contains the data for your class, the delegation model does the nasty bit). Why do you want to do that?

    kind regards,

    Jos

Similar Threads

  1. Replies: 1
    Last Post: 02-04-2010, 11:12 AM
  2. checking file extensions
    By gisler in forum New To Java
    Replies: 3
    Last Post: 12-05-2009, 01:25 PM
  3. running .class files on a website
    By jklsemicolon in forum Networking
    Replies: 10
    Last Post: 08-08-2008, 06:21 AM
  4. How to compare file extensions?
    By Rubin in forum New To Java
    Replies: 1
    Last Post: 08-05-2007, 09:51 PM
  5. Problems in running client class
    By ai_2007 in forum Advanced Java
    Replies: 0
    Last Post: 06-30-2007, 02:57 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •