java - Main method not found -
when seek excute java class below (auctionexample1.java), got next error : "selection not contain main type"
here java class :
package org.cloudbus.cloudsim.examples.auction; /** * simple illustration showing how create bidder datacenter , bidder broker * , start auction. * no vm specified @ because no 1 wins auction. * * created on 2011/9/9 */ import java.text.decimalformat; import java.util.arraylist; import java.util.calendar; import java.util.linkedlist; import java.util.list; import org.cloudbus.cloudsim.cloudlet; import org.cloudbus.cloudsim.cloudletschedulertimeshared; import org.cloudbus.cloudsim.datacentercharacteristics; import org.cloudbus.cloudsim.host; import org.cloudbus.cloudsim.log; import org.cloudbus.cloudsim.pe; import org.cloudbus.cloudsim.storage; import org.cloudbus.cloudsim.utilizationmodel; import org.cloudbus.cloudsim.utilizationmodelfull; import org.cloudbus.cloudsim.vm; import org.cloudbus.cloudsim.vmallocationpolicysimple; import org.cloudbus.cloudsim.vmschedulertimeshared; import org.cloudbus.cloudsim.auction.auctioneer.auctioneer; import org.cloudbus.cloudsim.auction.bid.datacenterbid; import org.cloudbus.cloudsim.auction.bid.datacenterbrokerbid; import org.cloudbus.cloudsim.auction.bidder.bidderdatacenter; import org.cloudbus.cloudsim.auction.bidder.bidderdatacenterbroker; import org.cloudbus.cloudsim.auction.vm.datacenterabstractvm; import org.cloudbus.cloudsim.auction.vm.vmcharacteristics; import org.cloudbus.cloudsim.core.cloudsim; import org.cloudbus.cloudsim.provisioners.bwprovisionersimple; import org.cloudbus.cloudsim.provisioners.peprovisionersimple; import org.cloudbus.cloudsim.provisioners.ramprovisionersimple; public class auctionexample1 { /** cloudlet list. */ private static list<cloudlet> cloudletlist; /** vmlist. */ private static list<vm> vmlist; /** * creates main() run example. * * @param args args */ public static void main(string[] args) { log.printline("starting auctionexample1..."); seek { // first step: initialize cloudsim package. should called // before creating entities. int num_user = 1; // number of cloud users calendar calendar = calendar.getinstance(); boolean trace_flag = false; // mean trace events // initialize cloudsim library cloudsim.init(num_user, calendar, trace_flag); auctioneer.initauctioneer(); // sec step: create datacenters // datacenters resource providers in cloudsim. need @ // list 1 of them run cloudsim simulation bidderdatacenter datacenter0 = createdatacenter("datacenter_0"); // 3rd step: create broker bidderdatacenterbroker broker = createbroker(); int brokerid = broker.getid(); // 4th step: create 1 virtual machine vmlist = new arraylist<vm>(); // vm description int vmid = 0; int mips = 1000; /*youness: vm need allocated share of processing powerfulness on datacenter's hosts.*/ long size = 10000; // image size (mb) (youness: virtual machine's image size) int ram = 512; // vm memory (mb) long bw = 1000; int pesnumber = 1; // number of cpus string vmm = "xen"; // vmm name // create vm vm vm = new vm(vmid, brokerid, mips, pesnumber, ram, bw, size, vmm, new cloudletschedulertimeshared()); // add together vm vmlist vmlist.add(vm); // 5th step: create 1 cloudlet cloudletlist = new arraylist<cloudlet>(); // cloudlet properties int id = 0; long length = 400000; //mi cloudletlength long filesize = 300; //cloudletfilesize long outputsize = 300; //cloudletoutputsize utilizationmodel utilizationmodel = new utilizationmodelfull(); cloudlet cloudlet = new cloudlet(id, length, pesnumber, filesize, outputsize, utilizationmodel, utilizationmodel, utilizationmodel); cloudlet.setuserid(brokerid); cloudlet.setvmid(vmid);//youness: bind cloudlet vm. if not this, application assigns first created vm cloudlet // add together cloudlet list cloudletlist.add(cloudlet); // submit cloudlet list broker broker.submitcloudletlist(cloudletlist); datacenterbrokerbid brokerbid = new datacenterbrokerbid(broker.getid(), 0.0035); brokerbid.addvm(vm, 1); broker.submitbid(brokerbid); // 6th step: starts simulation cloudsim.startsimulation(); cloudsim.stopsimulation(); //final step: print results when simulation on list<cloudlet> newlist = broker.getcloudletreceivedlist(); printcloudletlist(newlist); // print debt of each user each datacenter datacenter0.printdebts(); log.printline("auctionexample1 finished!"); } grab (exception e) { e.printstacktrace(); log.printline("unwanted errors happen"); } } /** * creates datacenter. * * @param name name * * @return datacenter */ private static bidderdatacenter createdatacenter(string name) { // here steps needed create powerdatacenter: // 1. need create list store // our machine list<host> hostlist = new arraylist<host>(); // 2. machine contains 1 or more pes or cpus/cores. // in example, have 1 core. list<pe> pelist = new arraylist<pe>(); int mips = 1000; // 3. create pes , add together these list. pelist.add(new pe(0, new peprovisionersimple(mips))); // need store pe id , mips rating // 4. create host id , list of pes , add together them list // of machines int hostid = 0; int ram = 2048; // host memory (mb) long storage = 1000000; // host storage int bw = 10000; host host = new host( hostid, new ramprovisionersimple(ram), new bwprovisionersimple(bw), storage, pelist, new vmschedulertimeshared(pelist) ); hostlist.add(host); // our machine // 5. create datacentercharacteristics object stores // properties of info center: architecture, os, list of // machines, allocation policy: time- or space-shared, time zone // , cost (g$/pe time unit). string arch = "x86"; // scheme architecture string os = "linux"; // operating scheme string vmm = "xen"; double time_zone = 10.0; // time zone resource located double cost = 3.0; // cost of using processing in resource double costpermem = 0.05; // cost of using memory in resource double costperstorage = 0.001; // cost of using storage in // resource double costperbw = 0.0; // cost of using bw in resource linkedlist<storage> storagelist = new linkedlist<storage>(); // not adding san // devices datacentercharacteristics characteristics = new datacentercharacteristics( arch, os, vmm, hostlist, time_zone, cost, costpermem, costperstorage, costperbw); // 6. finally, need create powerdatacenter object. bidderdatacenter datacenter = null; seek { datacenter = new bidderdatacenter(name, characteristics, new vmallocationpolicysimple(hostlist), storagelist, 0); } grab (exception e) { e.printstacktrace(); } //todo check if vm fits host vmcharacteristics vmcharacteristics = new vmcharacteristics( arch, os, vmm, time_zone, cost, costpermem, costperstorage, costperbw); datacenterabstractvm vm = new datacenterabstractvm(1000, 1, 512, 1000, 1000, vmcharacteristics); datacenterbid bid = new datacenterbid(datacenter.getid()); bid.addvm(vm, 1); datacenter.submitbid(bid); homecoming datacenter; } // encourage users develop own broker policies, // submit vms , cloudlets according // specific rules of simulated scenario /** * creates broker. * * @return datacenter broker */ private static bidderdatacenterbroker createbroker() { bidderdatacenterbroker broker = null; seek { broker = new bidderdatacenterbroker("broker"); } grab (exception e) { e.printstacktrace(); homecoming null; } homecoming broker; } /** * prints cloudlet objects. * * @param list list of cloudlets */ private static void printcloudletlist(list<cloudlet> list) { int size = list.size(); cloudlet cloudlet; string indent = " "; log.printline(); log.printline("========== output =========="); log.printline("cloudlet id" + indent + "status" + indent + "data center id" + indent + "vm id" + indent + "time" + indent + "start time" + indent + "finish time"); decimalformat dft = new decimalformat("###.##"); (int = 0; < size; i++) { cloudlet = list.get(i); log.print(indent + cloudlet.getcloudletid() + indent + indent); if (cloudlet.getcloudletstatus() == cloudlet.success) { log.print("success"); log.printline(indent + indent + cloudlet.getresourceid() + indent + indent + indent + cloudlet.getvmid() + indent + indent + dft.format(cloudlet.getactualcputime()) + indent + indent + dft.format(cloudlet.getexecstarttime()) + indent + indent + dft.format(cloudlet.getfinishtime())); } } } }
i want add together note, construction of project not constituted packages. here outline description of project hierarchy :
/cloudauction /cloudauction/src /cloudauction/src/main /cloudauction/src/test /cloudauction/src/test/java /cloudauction/src/test/java/org.cloudbus.cloudsim.examples.auction /cloudauction/src/test/java/org.cloudbus.cloudsim.examples.auction/auctionexample1.java /cloudauction/src/test/java/org.cloudbus.cloudsim.examples.auction/auctionexample2.java /cloudauction/src/test/java/org.cloudbus.cloudsim.examples.auction/auctionexample3.java /cloudauction/src/test/java/org.cloudbus.cloudsim.examples.auction/auctionexample4.java /cloudauction/src/test/java/org.cloudbus.cloudsim.examples.auction/bidderbrokerfactory.java /cloudauction/src/test/java/org.cloudbus.cloudsim.examples.auction/bidderdatacenterfactory.java /cloudauction/target /cloudauction/pom.xml
can help me find solution problem, please ?
under src folder must have bundle name represented folders. in code have : org.cloudbus.cloudsim.examples.auction bundle name don't have same folders in src, folder need :
src/org/cloudbus/cloudsim/examples/auction/yourclass.java
java methods main
No comments:
Post a Comment