我测试了一下, 是没有问题的, ioc在jar里面:
// jar内的文件:
org/wendal/nutzmain/Main.class
ioc/dao.js
其中, Main的代码如下:
package net.wendal.nutzmain;
import org.nutz.dao.Dao;
import org.nutz.ioc.Ioc;
import org.nutz.ioc.impl.NutIoc;
import org.nutz.ioc.loader.json.JsonLoader;
public class Main {
public static void main(String[] args) {
// 仅做测试
Ioc ioc = new NutIoc(new JsonLoader("ioc/"));
ioc.get(Dao.class);
ioc.depose();
}
}
使用exe4j生成exe, 选console模式, 64bit模式,启动效果:
17-04-19 14:06:29.756 INFO [main] Select SystemLog as Nutz.Log implement
17-04-19 14:06:29.823 DEBUG [main] Locations count=3 time use 34ms
17-04-19 14:06:29.827 DEBUG [main] Found 1 resource by src( ioc/ ) , regex( ^(.+[.])(js|json)$ )
17-04-19 14:06:29.828 DEBUG [main] loading [dao.js]
17-04-19 14:06:29.874 DEBUG [main] Using 95 castor for Castors
17-04-19 14:06:29.877 DEBUG [main] Loaded 1 bean define from path=[ioc/] --> [dao]
17-04-19 14:06:29.879 INFO [main] NutIoc init begin ...
17-04-19 14:06:29.881 INFO [main] ... NutIoc init complete
17-04-19 14:06:29.884 DEBUG [main] Get 'dao'
17-04-19 14:06:29.887 DEBUG [main] Load AopConfigure for anno=org.nutz.ioc.aop.Aop by type=org.nutz.ioc.aop.config.impl.AnnotationAopConfigration
17-04-19 14:06:29.888 DEBUG [main] >> Load definition name=dao
17-04-19 14:06:29.889 DEBUG [main] Loading define for name=dao
17-04-19 14:06:29.892 DEBUG [main] Found IocObject(dao) in JsonLoader(paths=[ioc/])
17-04-19 14:06:29.893 DEBUG [main] >> Make...'dao'
17-04-19 14:06:29.903 DEBUG [main] Load class org.nutz.dao.impl.NutDao without AOP
17-04-19 14:06:29.904 DEBUG [main] Save object 'dao' to [app]
17-04-19 14:06:30.005 INFO [main] org.nutz.ioc.impl.NutIoc@885951223 is closing. startup date [17-04-19 14:06:29.879]
17-04-19 14:06:30.006 DEBUG [main] Depose object 'dao' ...
17-04-19 14:06:30.007 INFO [main] org.nutz.ioc.impl.NutIoc@885951223 is deposed. startup date [17-04-19 14:06:29.879]
C:\Program Files\exe4j\bin>