Adding jar and methods

Home Forums JPad Adding jar and methods

Tagged: , ,

This topic contains 3 replies, has 2 voices, and was last updated by  jlsebastian 2 years, 7 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #36

    jlsebastian
    Participant

    Hi,

    1. How can I declare a method?

    2. How to add a custom jar file and import it Jpad?

    Thanks,
    Joseph

    #38

    admin
    Keymaster

    Hi,
    1. You can declare methods like so:
    http://jpad.io/example/1v/dumpclass-example

    public static void main(String[] args) {
    
    	Pattern p = Pattern.compile("[a-z]");
    	DumpClass(Pattern.class);
    	
    	Matcher m = p.matcher("f");
    	DumpClass(m);
    	Dump(m);
    }
    
    public static void DumpClass(Object o) {
    	DumpClass(o.getClass());
    }
    
    public static void DumpClass(Class c) {
    	System.out.println("--Class " + c.getTypeName() + "--");
    	for (java.lang.reflect.Method m : c.getMethods()) {
    		Class rt = m.getReturnType();
    		Class[] pt = m.getParameterTypes();
    		System.out.print("\t" + rt.getName() + " " + m.getName() + "(");
    		for (java.lang.Class ct : pt) {
    			System.out.print(ct.getName() + ",");
    		}
    		System.out.println(")");
    	}
    	System.out.println();
    }

    2. Custom jar files is something we are working on, it will be in the next release, which should occur this week.

    #45

    admin
    Keymaster

    A limited version of adding your own jars is now supported:
    http://jpad.io/help/adding-a-jar

    I intend to add a much better method in future.
    I’m very interested to hear feedback and ideas on how you think this should work?

    #46

    jlsebastian
    Participant

    Thanks! It works jpad custom jar.
    As an alternative for adding custom jars, we should follow the standard IDE feature, eg:
    1. User right click project name
    2. User choose “Add Jar to library”
    3. User selects the location of the jar file
    4. System copies the jar file inside the project lib folder
    5. System adds the jar file in the classpath.

    custom jar code:

    package com.nu.test;
    
    public class Test {
       public void doIt(){
           System.out.println("Hello");
       } 
    }
    • This reply was modified 2 years, 7 months ago by  jlsebastian.
    • This reply was modified 2 years, 7 months ago by  jlsebastian.
    • This reply was modified 2 years, 7 months ago by  jlsebastian.
Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.